From b86f746d21ec0bdc0ea001a99c17f64d74bf9cfc Mon Sep 17 00:00:00 2001 From: azaozz Date: Wed, 28 Oct 2009 03:10:59 +0000 Subject: [PATCH] Fix possible bad query, props aaroncampbell, see #4529 git-svn-id: http://svn.automattic.com/wordpress/trunk@12122 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index f03e4b008..b9bf8ae9f 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -768,7 +768,7 @@ function wp_count_comments( $post_id = 0 ) { $where = ''; if ( $post_id > 0 ) - $where = $wpdb->prepare( "comment_post_ID = %d AND ", $post_id ); + $where = $wpdb->prepare( "WHERE comment_post_ID = %d", $post_id ); $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );