Decrease comment count only when deleting approved comments.

git-svn-id: https://develop.svn.wordpress.org/trunk@3271 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2005-12-05 05:31:27 +00:00
parent 35dcc72e9b
commit 94bc2195d4
1 changed files with 1 additions and 1 deletions

View File

@ -201,7 +201,7 @@ function wp_delete_comment($comment_id) {
return false;
$post_id = $comment->comment_post_ID;
if ( $post_id )
if ( $post_id && $comment->comment_approved == 1 )
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = comment_count - 1 WHERE ID = '$post_id'" );
do_action('wp_set_comment_status', $comment_id, 'delete');