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:
parent
1e28b7c8cb
commit
de36de7a8e
|
@ -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');
|
||||||
|
|
Loading…
Reference in New Issue