Allow users to sort posts by type in WP_Query.

Props DeBAAT.
Fixes #28214.

Built from https://develop.svn.wordpress.org/trunk@28605


git-svn-id: http://core.svn.wordpress.org/trunk@28429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-05-29 00:24:14 +00:00
parent d40280d0db
commit fa38396998

View File

@ -2622,7 +2622,7 @@ class WP_Query {
$orderby = "FIELD( {$wpdb->posts}.post_parent, $post_parent__in )";
} else {
// 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', 'type' );
if ( !empty($q['meta_key']) ) {
$allowed_keys[] = $q['meta_key'];
$allowed_keys[] = 'meta_value';