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.5.2

apply_filters('pre_wp_update_comment_count_now') is found 1 times:

  • /wp-includes/comment.php line 2746
    	 * @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;
    	}