Fix possible bad query, props aaroncampbell, see #4529
git-svn-id: http://svn.automattic.com/wordpress/trunk@12122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d0c8558025
commit
b86f746d21
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue