lundi 2 février 2015

Sorting "menu_order" does not work in WP Query with multiple post types


When i use my WP Query as follows:



$post_types = array('research');

$args = array(
'posts_per_page' => 10,
'orderby' => 'menu_order',
'order' => 'asc',
'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
'post_type' => $post_types,
'post_status' => 'publish',
);


Everything works fine. The posts are sorted by the 'menu_order' value.


But once i add more post types to the array:



$post_types = array('research', 'course-webinar', 'project');


The order goes completely wild and doesn't make sense anymore.


It shows the posts grouped by post type name asc. And the menu_order value is completely ignored.


Does anyone know why?





Aucun commentaire:

Enregistrer un commentaire