rest_comment_collection_params
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 to set WP_Comment_Query parameters.
Usage
add_filter( 'rest_comment_collection_params', 'wp_kama_rest_comment_collection_params_filter' ); /** * Function for `rest_comment_collection_params` filter-hook. * * @param array $query_params JSON Schema-formatted collection parameters. * * @return array */ function wp_kama_rest_comment_collection_params_filter( $query_params ){ // filter... return $query_params; }
- $query_params(array)
- JSON Schema-formatted collection parameters.
Changelog
Since 4.7.0 | Introduced. |
Where the hook is called
rest_comment_collection_params
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1696
return apply_filters( 'rest_comment_collection_params', $query_params );