WordPress.org

Make WordPress Core

Ticket #21101: 21101.diff

File 21101.diff, 1.1 KB (added by dd32, 7 years ago)
  • comment.php

     
    223223                        'user_id' => '',
    224224                        'search' => '',
    225225                        'count' => false,
    226                         // lets us override the status query var by explicitly setting a value for comment_approved
    227                         'comment_approved' => false,
    228226                );
    229227
    230228                $this->query_vars = wp_parse_args( $query_vars, $defaults );
     
    250248                        $approved = "comment_approved = '0'";
    251249                elseif ( 'approve' == $status )
    252250                        $approved = "comment_approved = '1'";
    253                 elseif ( 'spam' == $status )
    254                         $approved = "comment_approved = 'spam'";
    255                 elseif ( 'trash' == $status )
    256                         $approved = "comment_approved = 'trash'";
     251                elseif ( ! empty( $status ) )
     252                        $approved = $wpdb->prepare( "comment_approved = %s", $status );
    257253                else
    258254                        $approved = "( comment_approved = '0' OR comment_approved = '1' )";
    259255
    260                 if ( false !== $comment_approved ) {
    261                         $approved = $wpdb->prepare( 'comment_approved = %s', $comment_approved );
    262                 }
    263 
    264256                $order = ( 'ASC' == strtoupper($order) ) ? 'ASC' : 'DESC';
    265257
    266258                if ( ! empty( $orderby ) ) {