Title: the_comments
Published: April 25, 2014
Last modified: April 28, 2025

---

# apply_filters_ref_array( ‘the_comments’, WP_Comment[] $_comments, WP_Comment_Query $query )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/the_comments/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/the_comments/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/the_comments/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/the_comments/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/the_comments/?output_format=md#wp--skip-link--target)

Filters the comment query results.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/the_comments/?output_format=md#parameters)󠁿

 `$_comments`[WP_Comment](https://developer.wordpress.org/reference/classes/wp_comment/)[]

An array of comments.

`$query`[WP_Comment_Query](https://developer.wordpress.org/reference/classes/wp_comment_query/)

Current instance of [WP_Comment_Query](https://developer.wordpress.org/reference/classes/wp_comment_query/)(
passed by reference).

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/the_comments/?output_format=md#source)󠁿

    ```php
    $_comments = apply_filters_ref_array( 'the_comments', array( $_comments, &$this ) );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-comment-query.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-comment-query.php#L522)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-comment-query.php#L522-L522)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/the_comments/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Comment_Query::get_comments()](https://developer.wordpress.org/reference/classes/wp_comment_query/get_comments/)`wp-includes/class-wp-comment-query.php` |

Get a list of comments matching the query vars.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/the_comments/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fthe_comments%2F)
before being able to contribute a note or feedback.