pre_wp_update_comment_count_now

pre_wp_update_comment_count_now

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: wordpress-6.7.2

apply_filters('pre_wp_update_comment_count_now') is found 1 times:

  • /wp-includes/comment.php line 2774
    2770
    2771
    2772
    2773
    2774
    2775
    2776
    2777
    2778
    2779
    2780
    * @param int|null $new     The new comment count. Default null.
     * @param int      $old     The old comment count.
     * @param int      $post_id Post ID.
     */
    $new = apply_filters( 'pre_wp_update_comment_count_now', null, $old, $post_id );
     
    if ( is_null( $new ) ) {
        $new = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id ) );
    } else {
        $new = (int) $new;
    }