comments_array filter-hookWP 2.1.0

Filters the comments array.

Usage

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)
Array of comments supplied to the comments template.
$post_id(int)
Post ID.

Changelog

Since 2.1.0 Introduced.

Where the hook is called

comments_template()
comments_array
wp-includes/comment-template.php 1581
$wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID );

Where the hook is used in WordPress

Usage not found.