Allow orderby=post__in, which uses the explicit order you provided in the post__in parameter. fixes #13729. props jakemgold, Otto42.

git-svn-id: http://core.svn.wordpress.org/trunk@21776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2012-09-06 19:01:21 +00:00
parent 1e28b7c8cb
commit de36de7a8e
1 changed files with 2 additions and 0 deletions

View File

@ -2331,6 +2331,8 @@ class WP_Query {
$orderby = "$wpdb->posts.post_date " . $q['order'];
} elseif ( 'none' == $q['orderby'] ) {
$orderby = '';
} elseif ( $q['orderby'] == 'post__in' && ! empty( $post__in ) ) {
$orderby = "FIELD( {$wpdb->posts}.ID, $post__in )";
} else {
// Used to filter values
$allowed_keys = array('name', 'author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand', 'comment_count');