get_comments_number
Filters the returned comment count for a post.
Использование
add_filter( 'get_comments_number', 'wp_kama_get_comments_number_filter', 10, 2 ); /** * Function for `get_comments_number` filter-hook. * * @param string|int $comments_number A string representing the number of comments a post has, otherwise 0. * @param int $post_id Post ID. * * @return string|int */ function wp_kama_get_comments_number_filter( $comments_number, $post_id ){ // filter... return $comments_number; }
- $comments_number(строка|int)
- A string representing the number of comments a post has, otherwise 0.
- $post_id(int)
- Post ID.
Список изменений
С версии 1.5.0 | Введена. |
Где вызывается хук
get_comments_number
wp-includes/comment-template.php 921
return apply_filters( 'get_comments_number', $comments_number, $post_id );