我试图通过meta\\u键查询自定义帖子排序。但是在运行WP\\u查询之后,order子句中的sql查询没有任何更改。
$args = array(
\'post_type\' => \'event\',
\'post_status\' => \'publish\',
\'meta_key\' => \'_start_eventtimestamp\',
\'orderby\' => \'meta_value_datetime\',
\'order\' => \'ASC\',
\'meta_query\' => array(
array(
\'key\' => \'_start_eventtimestamp\',
\'value\' => date(\'Ymd\'),
\'compare\' => \'>=\'
)
),
\'posts_per_page\' => \'7\',
);
$event_query = new WP_Query( $args );
当我得到生成的查询时,我得到了:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts
INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )
INNER JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id )
WHERE 1=1 AND ( wp_postmeta.meta_key = \'_start_eventtimestamp\'
AND ( ( mt1.meta_key = \'_start_eventtimestamp\' AND mt1.meta_value >= \'20160930\' ) ) )
AND wp_posts.post_type = \'event\' AND ((wp_posts.post_status = \'publish\'))
GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order ASC LIMIT 0, 7
订单条款没有变化
我的按meta\\u键排序的脚本中是否有错误?