comments_number
Filters the comments count for display.
Usage
add_filter( 'comments_number', 'wp_kama_comments_number_filter', 10, 2 );
/**
* Function for `comments_number` filter-hook.
*
* @param string $comments_number_text A translatable string formatted based on whether the count is equal to 0, 1, or 1+.
* @param int $comments_number The number of post comments.
*
* @return string
*/
function wp_kama_comments_number_filter( $comments_number_text, $comments_number ){
// filter...
return $comments_number_text;
}
- $comments_number_text(string)
- A translatable string formatted based on whether the count is equal to 0, 1, or 1+.
- $comments_number(int)
- The number of post comments.
Changelog
| Since 1.5.0 | Introduced. |
Where the hook is called
comments_number
wp-includes/comment-template.php 1012
return apply_filters( 'comments_number', $comments_number_text, $comments_number );