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:
Joe Hoyle
2016-11-14 16:41:40 +00:00
parent 58169b04fa
commit 850dd1be76
3 changed files with 40 additions and 3 deletions

View File

@@ -1298,6 +1298,17 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
),
);
return $query_params;
/**
* Filter collection parameters for the users controller.
*
* This filter registers the collection parameter, but does not map the
* collection parameter to an internal WP_User_Query parameter. Use the
* `rest_user_query` filter to set WP_User_Query arguments.
*
* @since 4.7.0
*
* @param $params JSON Schema-formatted collection parameters.
*/
return apply_filters( 'rest_user_collection_params', $query_params );
}
}