Make WordPress Core

Changeset 21570


Ignore:
Timestamp:
08/21/2012 09:56:16 AM (14 years ago)
Author:
westi
Message:

Comments: Allow the caller of get_comments() to request comments with a specific comment_approved value.

This allows for a custom comment status to be queried directly overriding the status argument.

See #21101 props nbachiyski.

File:
1 edited

Legend:

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

    r21506 r21570  
    223223                        'user_id' => '',
    224224                        'search' => '',
    225                         'count' => false
     225                        'count' => false,
     226                        // lets us override the status query var by explicitly setting a value for comment_approved
     227                        'comment_approved' => false,
    226228                );
    227229
    … …  
    255257                else
    256258                        $approved = "( comment_approved = '0' OR comment_approved = '1' )";
     259
     260                if ( false !== $comment_approved ) {
     261                        $approved = $wpdb->prepare( 'comment_approved = %s', $comment_approved );
     262                }
    257263
    258264                $order = ( 'ASC' == strtoupper($order) ) ? 'ASC' : 'DESC';
Note: See TracChangeset for help on using the changeset viewer.