Filter hook 'rest_comment_collection_params'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php at line 1712

View Source

rest_comment_collection_params

Filter Hook
Description
Filters REST API collection parameters for the comments controller. This filter registers the collection parameter, but does not map the collection parameter to an internal WP_Comment_Query parameter. Use the `rest_comment_query` filter to set WP_Comment_Query parameters.

Hook Information

File Location wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php View on GitHub
Hook Type Filter
Line Number 1712

Hook Parameters

Type Name Description
array $query_params JSON Schema-formatted collection parameters.

Usage Examples

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

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

Source Code Context

wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:1712 - How this hook is used in WordPress core
<?php
1707  		 *
1708  		 * @since 4.7.0
1709  		 *
1710  		 * @param array $query_params JSON Schema-formatted collection parameters.
1711  		 */
1712  		return apply_filters( 'rest_comment_collection_params', $query_params );
1713  	}
1714  
1715  	/**
1716  	 * Sets the comment_status of a given comment object when creating or updating a comment.
1717  	 *

PHP Documentation

<?php
/**
		 * Filters REST API collection parameters for the comments controller.
		 *
		 * This filter registers the collection parameter, but does not map the
		 * collection parameter to an internal WP_Comment_Query parameter. Use the
		 * `rest_comment_query` filter to set WP_Comment_Query parameters.
		 *
		 * @since 4.7.0
		 *
		 * @param array $query_params JSON Schema-formatted collection parameters.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
Related Hooks

Related hooks will be displayed here in future updates.