首先suppress_filters
有两个P。
其次,“countries”=>“default”在普通查询中没有任何作用,因此我怀疑您在代码方面还存在其他问题。
第三,当我用这个代码进行查询时
$sliders = new WP_Query(array(\'post_type\' => \'sliders\',
\'showposts\' => \'10\',
\'orderby\' => \'menu_order\',
\'order\' => \'ASC\',
\'countries\'=> \'Default\',
\'suppress_filters\' => true,
\'meta_query\' => array( array(
\'key\' => \'_sectors\',
\'value\' => 540,
\'compare\' => \'IN\',
) ),
) );
我得到这个结果:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = \'sliders\' AND (wp_posts.post_status = \'publish\' OR wp_posts.post_status = \'future\' OR wp_posts.post_status = \'draft\' OR wp_posts.post_status = \'pending\' OR wp_posts.post_author = 1 AND wp_posts.post_status = \'private\') AND ( (wp_postmeta.meta_key = \'_sectors\' AND CAST(wp_postmeta.meta_value AS CHAR) IN (\'540\')) ) GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order ASC LIMIT 0, 10
请注意,按菜单顺序排序是正确的。