Decrease comment count only when deleting approved comments.

git-svn-id: http://svn.automattic.com/wordpress/trunk@3271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-12-05 05:31:27 +00:00
parent fbaf9428a0
commit 9dc3881715

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