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 );