[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class-wp-comment-query.php (summary)

Comment API: WP_Comment_Query class

File Size: 1234 lines (48 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Comment_Query:: (11 methods):
  __call()
  __construct()
  parse_query()
  query()
  get_comments()
  get_comment_ids()
  set_found_comments()
  fill_descendants()
  get_search_sql()
  parse_orderby()
  parse_order()


Class: WP_Comment_Query  - X-Ref

Core class used for querying comments.

__call( $name, $arguments )   X-Ref
Make private/protected methods readable for backward compatibility.

since: 4.0.0
return: mixed|false Return value of the callback, false otherwise.
param: string $name      Method to call.
param: array  $arguments Arguments to pass when calling.

__construct( $query = '' )   X-Ref
Constructor.

Sets up the comment query, based on the query vars passed.

since: 4.2.0
since: 4.4.0 `$parent__in` and `$parent__not_in` were added.
since: 4.4.0 Order by `comment__in` was added. `$update_comment_meta_cache`, `$no_found_rows`,
since: 4.5.0 Introduced the `$author_url` argument.
since: 4.6.0 Introduced the `$cache_domain` argument.
since: 4.9.0 Introduced the `$paged` argument.
since: 5.1.0 Introduced the `$meta_compare_key` argument.
since: 5.3.0 Introduced the `$meta_type_key` argument.
param: string|array $query {

parse_query( $query = '' )   X-Ref
Parse arguments passed to the comment query with default query parameters.

since: 4.2.0 Extracted from WP_Comment_Query::query().
param: string|array $query WP_Comment_Query arguments. See WP_Comment_Query::__construct()

query( $query )   X-Ref
Sets up the WordPress query for retrieving comments.

since: 3.1.0
since: 4.1.0 Introduced 'comment__in', 'comment__not_in', 'post_author__in',
since: 4.2.0 Moved parsing to WP_Comment_Query::parse_query().
return: array|int List of comments, or number of comments when 'count' is passed as a query var.
param: string|array $query Array or URL query string of parameters.

get_comments()   X-Ref
Get a list of comments matching the query vars.

since: 4.2.0
return: int|int[]|WP_Comment[] List of comments or number of found comments if `$count` argument is true.

get_comment_ids()   X-Ref
Used internally to get a list of comment IDs matching the query vars.

since: 4.4.0
return: int|array A single count of comment IDs if a count query. An array of comment IDs if a full query.

set_found_comments()   X-Ref
Populates found_comments and max_num_pages properties for the current
query if the limit clause was used.

since: 4.6.0

fill_descendants( $comments )   X-Ref
Fetch descendants for located comments.

Instead of calling `get_children()` separately on each child comment, we do a single set of queries to fetch
the descendant trees for all matched top-level comments.

since: 4.4.0
return: array
param: WP_Comment[] $comments Array of top-level comments whose descendants should be filled in.

get_search_sql( $search, $columns )   X-Ref
Used internally to generate an SQL string for searching across multiple columns.

since: 3.1.0
return: string Search SQL.
param: string   $search  Search string.
param: string[] $columns Array of columns to search.

parse_orderby( $orderby )   X-Ref
Parse and sanitize 'orderby' keys passed to the comment query.

since: 4.2.0
return: string|false Value to used in the ORDER clause. False otherwise.
param: string $orderby Alias for the field to order by.

parse_order( $order )   X-Ref
Parse an 'order' query variable and cast it to ASC or DESC as necessary.

since: 4.2.0
return: string The sanitized 'order' query variable.
param: string $order The 'order' query variable.



Generated: Fri Mar 29 01:00:02 2024 Cross-referenced by PHPXref 0.7.1