Filter hook 'get_page_of_comment_query_args'

in WP Core File wp-includes/comment.php at line 1143

View Source

get_page_of_comment_query_args

Filter Hook
Description
Filters the arguments used to query comments in get_page_of_comment(). Accepts 'comment', 'trackback', 'pingback', 'pings' (trackbacks and pingbacks), or 'all'. Default 'all'. of comment objects (false). will be included in paginated comments. }

Hook Information

File Location wp-includes/comment.php View on GitHub
Hook Type Filter
Line Number 1143

Hook Parameters

Type Name Description
array $comment_args { Array of WP_Comment_Query arguments.

Usage Examples

Basic Usage
<?php
// Hook into get_page_of_comment_query_args
add_filter('get_page_of_comment_query_args', 'my_custom_filter', 10, 1);

function my_custom_filter($comment_args) {
    // Your custom filtering logic here
    return $comment_args;
}

Source Code Context

wp-includes/comment.php:1143 - How this hook is used in WordPress core
<?php
1138  		 *     @type array  $date_query         Date query clauses to limit comments by. See WP_Date_Query.
1139  		 *     @type array  $include_unapproved Array of IDs or email addresses whose unapproved comments
1140  		 *                                      will be included in paginated comments.
1141  		 * }
1142  		 */
1143  		$comment_args = apply_filters( 'get_page_of_comment_query_args', $comment_args );
1144  
1145  		$comment_query       = new WP_Comment_Query();
1146  		$older_comment_count = $comment_query->query( $comment_args );
1147  
1148  		// No older comments? Then it's page #1.

PHP Documentation

<?php
/**
		 * Filters the arguments used to query comments in get_page_of_comment().
		 *
		 * @since 5.5.0
		 *
		 * @see WP_Comment_Query::__construct()
		 *
		 * @param array $comment_args {
		 *     Array of WP_Comment_Query arguments.
		 *
		 *     @type string $type               Limit paginated comments to those matching a given type.
		 *                                      Accepts 'comment', 'trackback', 'pingback', 'pings'
		 *                                      (trackbacks and pingbacks), or 'all'. Default 'all'.
		 *     @type int    $post_id            ID of the post.
		 *     @type string $fields             Comment fields to return.
		 *     @type bool   $count              Whether to return a comment count (true) or array
		 *                                      of comment objects (false).
		 *     @type string $status             Comment status.
		 *     @type int    $parent             Parent ID of comment to retrieve children of.
		 *     @type array  $date_query         Date query clauses to limit comments by. See WP_Date_Query.
		 *     @type array  $include_unapproved Array of IDs or email addresses whose unapproved comments
		 *                                      will be included in paginated comments.
		 * }
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.