Allow get_comments() to query for explicit value of comment_approved.
Props dd32, nbachiyski fixes #21101 git-svn-id: http://core.svn.wordpress.org/trunk@22068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
32b4571c18
commit
9f32de9496
|
@ -223,8 +223,6 @@ class WP_Comment_Query {
|
|||
'user_id' => '',
|
||||
'search' => '',
|
||||
'count' => false,
|
||||
// lets us override the status query var by explicitly setting a value for comment_approved
|
||||
'comment_approved' => false,
|
||||
);
|
||||
|
||||
$this->query_vars = wp_parse_args( $query_vars, $defaults );
|
||||
|
@ -250,17 +248,11 @@ class WP_Comment_Query {
|
|||
$approved = "comment_approved = '0'";
|
||||
elseif ( 'approve' == $status )
|
||||
$approved = "comment_approved = '1'";
|
||||
elseif ( 'spam' == $status )
|
||||
$approved = "comment_approved = 'spam'";
|
||||
elseif ( 'trash' == $status )
|
||||
$approved = "comment_approved = 'trash'";
|
||||
elseif ( ! empty( $status ) )
|
||||
$approved = $wpdb->prepare( "comment_approved = %s", $status );
|
||||
else
|
||||
$approved = "( comment_approved = '0' OR comment_approved = '1' )";
|
||||
|
||||
if ( false !== $comment_approved ) {
|
||||
$approved = $wpdb->prepare( 'comment_approved = %s', $comment_approved );
|
||||
}
|
||||
|
||||
$order = ( 'ASC' == strtoupper($order) ) ? 'ASC' : 'DESC';
|
||||
|
||||
if ( ! empty( $orderby ) ) {
|
||||
|
|
Loading…
Reference in New Issue