WordPress.org

Make WordPress Core

Ticket #15565: 15565.1.diff

File 15565.1.diff, 597 bytes (added by mdawaffe, 7 years ago)

Option 1

  • wp-includes/comment.php

     
    15621562
    15631563        $old = (int) $post->comment_count;
    15641564        $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) );
     1565
     1566        do_action('wp_updating_comment_count', $post_id, $new, $old);
     1567
    15651568        $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) );
    15661569
    15671570        if ( 'page' == $post->post_type )