﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
21618,WP_Query should accept menu_order as a query arg,wonderboymusic,ryan,"With custom post types, you can use the Posts table for basically anything. {{{menu_order}}} can be especially useful for holding foreign ids (after you add an index to it). The problem is that {{{menu_order}}} can't be passed to {{{WP_Query}}}:

{{{
add_filter( 'query', function ( $sql ) { error_log( $sql ); return $sql; } );
$stuff = new WP_Query( array( 'menu_order' => 5 ) );
exit();

// SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10

}}} 

My patch fixes that, the result is now:
{{{
SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.menu_order = 5 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10
}}}

",defect (bug),closed,normal,3.5,Query,2.0,normal,fixed,has-patch commit,georgemamadashvili@…
