wp_count_comments filter-hook . WP 2.7.0
Filters the comments count for a given post or the whole site.
Usage
add_filter( 'wp_count_comments', 'filter_function_name_2579', 10, 2 ); function filter_function_name_2579( $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-includes/comment.php 1432
$filtered = apply_filters( 'wp_count_comments', array(), $post_id );