id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 15388 get_posts does not order by menu_order ggus "I'm writing a plugin that makes use of custom post_types. The plugin (in the back-end) aims to manage a group of custom posts children of the actually edited custom post. I manage the ordering via the menu_order. a statement like {{{ get_posts('post_type=whatever&post_parent='.$post->ID.'$orderby=menu_order&order=ASC') }}} does not order by menu_order, instead it returns the elements ordered by the default order (id?) As reported in [http://wordpress.org/support/topic/get_posts-not-using-orderbymenu_order#post-1006470] and also as stated in this bug fix: [http://core.trac.wordpress.org/ticket/6731] there is in the core file query.php at line 2147 (WP Version 3.0.1) {{{ switch ( $orderby ) { case 'menu_order': break; }}} In this way every request to order by menu_order gets ignored. It seems that query_posts function is unaffected by this, so {{{ query_posts(array('post_type' => 'whatever', 'post_parent' => $post->ID , 'order' => 'ASC', 'orderby' => 'menu_order')); }}} does work, but I fear there are some implications in using query_posts instead of get_posts. There is a solution proposed in the same page [http://wordpress.org/support/topic/get_posts-not-using-orderbymenu_order#post-1006470] that fixes the bug by changing the code to {{{ case 'menu_order': $orderby = ""$wpdb->posts.menu_order""; break; }}}" defect (bug) closed normal Query 3.0.4 normal worksforme menu_order get_posts orderby