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

git-svn-id: https://develop.svn.wordpress.org/trunk@21776 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2012-09-06 19:01:21 +00:00
parent 5b6d894b43
commit c5c65130c9

View File

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