Allow querying by menu_order. Props wonderboymusic. fixes #21618

git-svn-id: http://core.svn.wordpress.org/trunk@21748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-09-04 21:09:27 +00:00
parent 38c261bc37
commit dc8bbc5a59
1 changed files with 4 additions and 0 deletions

View File

@ -1452,6 +1452,7 @@ class WP_Query {
if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']); if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']); if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']); if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']);
// Compat. Map subpost to attachment. // Compat. Map subpost to attachment.
if ( '' != $qv['subpost'] ) if ( '' != $qv['subpost'] )
@ -2040,6 +2041,9 @@ class WP_Query {
$fields = "$wpdb->posts.*"; $fields = "$wpdb->posts.*";
} }
if ( '' !== $q['menu_order'] )
$where .= " AND $wpdb->posts.menu_order = " . $q['menu_order'];
// If a month is specified in the querystring, load that month // If a month is specified in the querystring, load that month
if ( $q['m'] ) { if ( $q['m'] ) {
$q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']); $q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']);