Title: comments_clauses
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters_ref_array( ‘comments_clauses’, string[] $clauses, WP_Comment_Query $query )

## In this article

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

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

Filters the comment query clauses.

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

 `$clauses`string[]

Associative array of the clauses for the query.

 * `fields` string
 * The SELECT clause of the query.
 * `join` string
 * The JOIN clause of the query.
 * `where` string
 * The WHERE clause of the query.
 * `orderby` string
 * The ORDER BY clause of the query.
 * `limits` string
 * The LIMIT clause of the query.
 * `groupby` string
 * The GROUP BY clause of the query.

`$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/comments_clauses/?output_format=md#source)󠁿

    ```php
    $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$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/7.0/src/wp-includes/class-wp-comment-query.php#L950)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-comment-query.php#L950-L950)

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

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

Used internally to get a list of comment IDs matching the query vars.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/comments_clauses/?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%2Fcomments_clauses%2F)
before being able to contribute a note or feedback.