comments_array
Filters the comments array.
Использование
add_filter( 'comments_array', 'wp_kama_comments_array_filter', 10, 2 );
/**
* Function for `comments_array` filter-hook.
*
* @param array $comments Array of comments supplied to the comments template.
* @param int $post_id Post ID.
*
* @return array
*/
function wp_kama_comments_array_filter( $comments, $post_id ){
// filter...
return $comments;
}
- $comments(массив)
- Array of comments supplied to the comments template.
- $post_id(int)
- Post ID.
Список изменений
| С версии 2.1.0 | Введена. |
Где вызывается хук
wp-includes/comment-template.php 1589
$wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID );