我为页面编写了以下自定义查询-
$menu_loop = new WP_Query( array( \'post_type\' => \'page\', \'posts_per_page\' => 50, \'post_parent\' => 616, \'order_by\' => \'post_title\', \'order\' => \'ASC\' ) );
while ($menu_loop->have_posts()) : $menu_loop->the_post();
问题是,当内容输出到页面时,它不是按post\\u标题的字母顺序排列的。这让我很困惑,因为如果我用-
SELECT * FROM wp_2_posts WHERE post_type = \'page\' AND post_parent = 616 ORDER BY post_title ASC
然后正确返回结果。此外,我print\\r($menu\\u loop),其中一个数组条目是发送到DB的实际查询,它是错误的,并且显示-
[request] => SELECT SQL_CALC_FOUND_ROWS wp_2_posts.* FROM wp_2_posts WHERE 1=1 AND wp_2_posts.post_parent = 616 AND wp_2_posts.post_type = \'page\' AND (wp_2_posts.post_status = \'publish\') ORDER BY wp_2_posts.post_date ASC LIMIT 0, 50
如果你看一下,你会发现ORDER BY语句是按发布日期排序的,而不是按文章标题排序的。
我做错了什么?