From dc8bbc5a59bf86e0d7b4f9c98f895e0c3c55b93b Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 4 Sep 2012 21:09:27 +0000 Subject: [PATCH] Allow querying by menu_order. Props wonderboymusic. fixes #21618 git-svn-id: http://core.svn.wordpress.org/trunk@21748 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/query.php b/wp-includes/query.php index 12bf1ae4cd..ff7155fde3 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1452,6 +1452,7 @@ class WP_Query { if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']); if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']); if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']); + if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']); // Compat. Map subpost to attachment. if ( '' != $qv['subpost'] ) @@ -2040,6 +2041,9 @@ class WP_Query { $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 ( $q['m'] ) { $q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']);