WP_Comment_Query
- Since
- 3.1.0
- Source
wp-includes/class-wp-comment-query.php:17
Core class used for querying comments.
Compatibility
- WordPress
- since 3.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 6
Every hook that fires from inside WP_Comment_Query, in the order it appears in the class, grouped by the method that fires it.
WP_Comment_Query::get_comments()
- do_action( pre_get_comments )action line 401
- apply_filters( comments_pre_query )filter line 441
- apply_filters( the_comments )filter line 529
Properties · 11
$requeststringpublic- SQL for database query.
$meta_queryWP_Meta_Querypublic- Metadata query container
$meta_query_clausesarrayprotected- Metadata query clauses.
$sql_clausesarrayprotected- SQL query clauses.
$filtered_where_clausestringprotected- SQL WHERE clause.
$date_queryWP_Date_Querypublic- Date query container
$query_varsarraypublic- Query vars set by the user.
$query_var_defaultsarraypublic- Default values for query vars.
$commentsint[]|WP_Comment[]|nullpublic- List of comments located by the query.
$found_commentsintpublic- The amount of found comments for the current query.
$max_num_pagesintpublic- The number of pages.
Methods · 11
- __call()Make private/protected methods readable for backward compatibility.
- __construct()Constructor.
- parse_query()Parse arguments passed to the comment query with default query parameters.
- query()Sets up the WordPress query for retrieving comments.
- get_comments()Get a list of comments matching the query vars.
- get_comment_ids()Used internally to get a list of comment IDs matching the query vars.
- set_found_comments()Populates found_comments and max_num_pages properties for the current query if the limit clause was used.
- fill_descendants()Fetch descendants for located comments.
- get_search_sql()Used internally to generate an SQL string for searching across multiple columns.
- parse_orderby()Parse and sanitize 'orderby' keys passed to the comment query.
- parse_order()Parse an 'order' query variable and cast it to ASC or DESC as necessary.
Changelog
Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/class-wp-comment-query.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.