pre_wp_update_comment_count_now filter-hookWP 4.5.0

Filters a post's comment count before it is updated in the database.

Usage

add_filter( 'pre_wp_update_comment_count_now', 'wp_kama_pre_wp_update_comment_count_now_filter', 10, 3 );

/**
 * Function for `pre_wp_update_comment_count_now` filter-hook.
 * 
 * @param int|null $new     The new comment count.
 * @param int      $old     The old comment count.
 * @param int      $post_id Post ID.
 *
 * @return int|null
 */
function wp_kama_pre_wp_update_comment_count_now_filter( $new, $old, $post_id ){

	// filter...
	return $new;
}
$new(int|null)
The new comment count.
Default: null
$old(int)
The old comment count.
$post_id(int)
Post ID.

Changelog

Since 4.5.0 Introduced.

Where the hook is called

wp_update_comment_count_now()
pre_wp_update_comment_count_now
wp-includes/comment.php 2678
$new = apply_filters( 'pre_wp_update_comment_count_now', null, $old, $post_id );

Where the hook is used in WordPress

Usage not found.