apply_filters( 'comments_array', array $comments , int $post_id )
Filters the comments array.
Parameters
-
$comments
array -
Array of comments supplied to the comments template.
-
$post_id
int -
Post ID.
More Information
Used inside comments_template that allows you to catch all the comments going through the query for the post.
Source
File: wp-includes/comment-template.php
.
View all references
$wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID );
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
If you want to hide all of the existing comments for your posts, use the following function to return an empty array: