我需要通过两个元字段查询帖子,而我使用的wo\\U查询没有返回任何内容。显然,它坏了。有人能告诉我我做错了什么吗?
$args = array(
\'post_type\' => \'espresso_event\',
\'post_status\' => \'publish\',
\'posts_per_page\' => 8,
\'category_name\' => \'homepage\',
\'meta_query\' => array(
array(
\'key\' => \'event_start_date\',
\'value\' => date(\'Y-m-d\'),
\'compare\' => \'>=\',
\'type\' => \'DATE\'
),
array(
\'key\' => \'event_end_time\',
\'value\' => date(\'g:i A\'),
\'compare\' => \'>=\',
\'type\' => \'TIME\'
)
),
\'orderby\' => \'meta_value\',
\'order\' => \'ASC\' // change this to ASC if you want newer events on top
);
// this saves the query to a temporary location so we can go back to it later after we run our query
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query($args);
查询在没有此部分的情况下工作:
array(
\'key\' => \'event_end_time\',
\'value\' => date(\'g:i A\'),
\'compare\' => \'>=\',
\'type\' => \'TIME\'
)
很明显,问题就在那里,但我没有得到任何错误或任何东西,所以我看不出问题是什么。