From 94bc2195d490cdc5218ec870f397d55948925159 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 5 Dec 2005 05:31:27 +0000 Subject: [PATCH] Decrease comment count only when deleting approved comments. git-svn-id: https://develop.svn.wordpress.org/trunk@3271 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/comment-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 5f52018c86..3bafa8ce88 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -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');