感谢您的回复,
允许我找到我在下面发布的正确答案-
$tickets_for_user = get_posts(array(
\'post_type\' => \'ticket\',
\'orderby\' => \'meta_value_num\',
\'meta_key\' => \'event_date\',
\'order\' => \'ASC\',
\'posts_per_page\' => 1,
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'key\' => \'event_date\',
\'value\' => array($today,\'20991231\'),
\'compare\' => \'BETWEEN\',
\'type\' => \'DATE\',
),
array(
\'key\' => \'member\',
\'value\' => $user_id
),
array(
\'key\' => \'state\',
\'value\' => \'complete\'
),
)
));
$tickets = array();
foreach($tickets_for_user as $ticket) {
Important note from the Codex:
仅当日期以YYYYMMDD格式存储并使用此格式测试时,“type”日期才与“compare”值一起使用。
您还必须将日期按顺序排列,最早的日期排在第一位。