wp_count_comments filter-hookWP 2.7.0

Filters the comments count for a given post or the whole site.

Usage

add_filter( 'wp_count_comments', 'wp_kama_count_comments_filter', 10, 2 );

/**
 * Function for `wp_count_comments` filter-hook.
 * 
 * @param array|stdClass $count   An empty array or an object containing comment counts.
 * @param int            $post_id The post ID. Can be 0 to represent the whole site.
 *
 * @return array|stdClass
 */
function wp_kama_count_comments_filter( $count, $post_id ){

	// filter...
	return $count;
}
$count(array|stdClass)
An empty array or an object containing comment counts.
$post_id(int)
The post ID. Can be 0 to represent the whole site.

Changelog

Since 2.7.0 Introduced.

Where the hook is called

wp_count_comments()
wp_count_comments
wp-includes/comment.php 1413
$filtered = apply_filters( 'wp_count_comments', array(), $post_id );

Where the hook is used in WordPress

Usage not found.