mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-27 18:16:08 +00:00
wp_update_comment_count() from MarkJaquith. fixes #2836
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ab7f591796
commit
805b2ad8e8
@ -221,8 +221,10 @@ function wp_delete_comment($comment_id) {
|
||||
return false;
|
||||
|
||||
$post_id = $comment->comment_post_ID;
|
||||
if ( $post_id && $comment->comment_approved == 1 )
|
||||
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = comment_count - 1 WHERE ID = '$post_id'" );
|
||||
if ( $post_id && $comment->comment_approved == 1 ) {
|
||||
$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'");
|
||||
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$post_id'" );
|
||||
}
|
||||
|
||||
do_action('wp_set_comment_status', $comment_id, 'delete');
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user