[wp-trac] [WordPress Trac] #28012: orderby post__in interferes with menu_order

WordPress Trac noreply at wordpress.org
Thu Apr 24 14:27:30 UTC 2014


#28012: orderby post__in interferes with menu_order
--------------------------+-----------------------------
 Reporter:  Matthias82    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  3.9
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi,

 with Version 3.9 the following issue came up.

 {{{

 $query_pages = array(3,9,6,2,10);

 $pagequery = array(
 'posts_per_page' => count($query_pages),
 'post_type' => 'page',
 'post__in' => $query_pages,
 'orderby'=> 'post__in');

 query_posts($pagequery);
 }}}

 When running through the loop, all posts on my front end have the same
 order as they have inside the $query_pages array. But once a post has a
 menu_order value like 1 or 2 it gets forced to the end of the loop and the
 order is distorted.

 Page Structure inside Dashboard:
 -- Page ( ID 3 )
 --- child of Page 3 with ( ID 6 and menu order 2 )
 --- child of Page 3 with ( ID 9 and menu order 1 )
 -- Page ( ID 2 )
 -- Page ( ID 10 )

 Expected Output by using the above code:
 -- Page ( ID 3 )
 -- Page ( ID 9 )
 -- Page ( ID 6 )
 -- Page ( ID 2 )
 -- Page ( ID 10 )

 Generated Output
 -- Page ( ID 3 )
 -- Page ( ID 2 )
 -- Page ( ID 10 )
 -- Page ( ID 9 )
 -- Page ( ID 6 )

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28012>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list