comments_template_query_args хук-фильтрWP 4.5.0

Filters the arguments used to query comments in comments_template().


add_filter( 'comments_template_query_args', 'wp_kama_comments_template_query_args_filter' );

 * Function for `comments_template_query_args` filter-hook.
 * @param array $comment_args Array of WP_Comment_Query arguments.
 * @return array
function wp_kama_comments_template_query_args_filter( $comment_args ){

	// filter...
	return $comment_args;

Array of WP_Comment_Query arguments.

  • orderby(строка|массив)
    Field(s) to order by.

  • order(строка)
    Order of results. Accepts 'ASC' or 'DESC'.

  • status(строка)
    Comment status.

  • include_unapproved(массив)
    Array of IDs or email addresses whose unapproved comments will be included in results.

  • post_id(int)
    ID of the post.

  • no_found_rows(true|false)
    Whether to refrain from querying for found rows.

  • update_comment_meta_cache(true|false)
    Whether to prime cache for comment meta.

  • hierarchical(true|false|строка)
    Whether to query for comments hierarchically.

  • offset(int)
    Comment offset.

  • number(int)
    Number of comments to fetch.

Список изменений

С версии 4.5.0 Введена.

Где вызывается хук

wp-includes/comment-template.php 1547
$comment_args = apply_filters( 'comments_template_query_args', $comment_args );

Где используется хук в WordPress

Использование не найдено.