From 9f32de949686a2e45cebde244ff1098409b89993 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 27 Sep 2012 18:08:02 +0000 Subject: [PATCH] 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 --- wp-includes/comment.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index a50a9396e5..acc25a1bee 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -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 ) ) {