Fix possible bad query, props aaroncampbell, see #4529

git-svn-id: https://develop.svn.wordpress.org/trunk@12122 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2009-10-28 03:10:59 +00:00
parent b86ab00920
commit 8a0569e144
1 changed files with 1 additions and 1 deletions

View File

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