mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-19 02:34:40 +00:00
REST API: Make all collection params filterable.
For developers wanting to add their own registered collection parameters, they can now use the `rest_$type_collection_params` filter. This brings consistency with the already existing `rest_$post_type_collection_params`. Fixes #38710. Props jnylen0. git-svn-id: https://develop.svn.wordpress.org/trunk@39223 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1389,7 +1389,18 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
return $query_params;
|
||||
/**
|
||||
* Filter 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 $params JSON Schema-formatted collection parameters.
|
||||
*/
|
||||
return apply_filters( 'rest_comment_collection_params', $query_params );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user