Allow ordering by comment_count. fixes #11037
git-svn-id: http://svn.automattic.com/wordpress/trunk@12127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6ecb855d33
commit
dd4b5f01c0
|
@ -2029,7 +2029,7 @@ class WP_Query {
|
|||
$q['orderby'] = '';
|
||||
} else {
|
||||
// Used to filter values
|
||||
$allowed_keys = array('author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand');
|
||||
$allowed_keys = array('author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand', 'comment_count');
|
||||
if ( !empty($q['meta_key']) ) {
|
||||
$allowed_keys[] = $q['meta_key'];
|
||||
$allowed_keys[] = 'meta_value';
|
||||
|
@ -2056,6 +2056,8 @@ class WP_Query {
|
|||
case 'meta_value':
|
||||
$orderby = "$wpdb->postmeta.meta_value";
|
||||
break;
|
||||
case 'comment_count':
|
||||
$orderby = "$wpdb->posts.comment_count";
|
||||
default:
|
||||
$orderby = "$wpdb->posts.post_" . $orderby;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue