WordPress.org

Make WordPress Core

Changeset 12127


Ignore:
Timestamp:
10/29/2009 06:02:55 PM (9 years ago)
Author:
markjaquith
Message:

Allow ordering by comment_count. fixes #11037

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r12062 r12127  
    20302030        } else {
    20312031            // Used to filter values
    2032             $allowed_keys = array('author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand');
     2032            $allowed_keys = array('author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand', 'comment_count');
    20332033            if ( !empty($q['meta_key']) ) {
    20342034                $allowed_keys[] = $q['meta_key'];
     
    20572057                        $orderby = "$wpdb->postmeta.meta_value";
    20582058                        break;
     2059                    case 'comment_count':
     2060                        $orderby = "$wpdb->posts.comment_count";
    20592061                    default:
    20602062                        $orderby = "$wpdb->posts.post_" . $orderby;
Note: See TracChangeset for help on using the changeset viewer.