My code is:
$sliders = new WP_Query(array('post_type' => 'sliders', 'showposts' => '10', 'orderby' => 'menu_order', 'order' => 'ASC', 'countries'=> 'Default', 'supress_filters' => true, 'meta_query' => array(
But wordpress orderby post_date 🙁
[query] => Array
(
[post_type] => sliders
[showposts] => 10
[orderby] => menu_order
[order] => ASC
[countries] => ES
[supress_filters] => 1
[meta_query] => Array
(
[0] => Array
(
[key] => _sectors
[value] => 540
[compare] => IN
)
)
)
[request] => SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) JOIN wp_icl_translations t ON wp_posts.ID = t.element_id
AND t.element_type="post_sliders" JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (16) ) AND wp_posts.post_type="sliders" AND (wp_posts.post_status="publish" OR wp_posts.post_status="private") AND ( (wp_postmeta.meta_key = '_sectors' AND CAST(wp_postmeta.meta_value AS CHAR) IN ('540')) ) AND t.language_code="es" GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
3 Answers
Use this instead. It worked for me
'sort_column' => 'menu_order'