WordPress.org

Make WordPress Core

Ticket #13091: 13091-opt2.patch

File 13091-opt2.patch, 575 bytes (added by solarissmoke, 8 years ago)

Check whether status is changing from/to approved before calling wp_update_comment_count()

  • comment.php

     
    13481348        do_action('wp_set_comment_status', $comment_id, $comment_status);
    13491349        wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment);
    13501350
    1351         wp_update_comment_count($comment->comment_post_ID);
     1351        if($status == '1' || $comment_old->comment_approved == 1) // then a comment has changed to/from approved
     1352                wp_update_comment_count($comment->comment_post_ID);
    13521353
    13531354        return true;
    13541355}