Make WordPress Core

Ticket #11398: 11398.diff

File 11398.diff, 1.0 KB (added by wonderboymusic, 13 years ago)
  • wp-includes/query.php

    diff --git wp-includes/query.php wp-includes/query.php
    index 04286aa..88f63a6 100644
    class WP_Query { 
    23612361                        $orderby = "FIELD( {$wpdb->posts}.post_parent, $post_parent__in )";
    23622362                } else {
    23632363                        // Used to filter values
    2364                         $allowed_keys = array('name', 'author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand', 'comment_count');
     2364                        $allowed_keys = array( 'name', 'author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand', 'comment_count', 'comment_date' );
    23652365                        if ( !empty($q['meta_key']) ) {
    23662366                                $allowed_keys[] = $q['meta_key'];
    23672367                                $allowed_keys[] = 'meta_value';
    class WP_Query { 
    23962396                                        case 'comment_count':
    23972397                                                $orderby = "$wpdb->posts.comment_count";
    23982398                                                break;
     2399                                        case 'comment_date':
     2400                                                $orderby = "$wpdb->comments.comment_date";
     2401                                                $join .= " LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID ";
     2402                                                break;
    23992403                                        default:
    24002404                                                $orderby = "$wpdb->posts.post_" . $orderby;
    24012405                                }