diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index 03d30b0e7a..afd64895e1 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -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 ); } /** diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php index 043966658d..422448f228 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php @@ -959,7 +959,22 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { 'type' => 'string', ); - return $query_params; + /** + * Filter collection parameters for the terms controller. + * + * The dynamic part of the filter `$this->taxonomy` refers to the taxonomy + * slug for the controller. + * + * This filter registers the collection parameter, but does not map the + * collection parameter to an internal WP_Term_Query parameter. Use the + * `rest_{$this->taxonomy}_query` filter to set WP_Term_Query parameters. + * + * @since 4.7.0 + * + * @param $params JSON Schema-formatted collection parameters. + * @param WP_Taxonomy $taxonomy_obj Taxonomy object. + */ + return apply_filters( 'rest_{$this->taxonomy}_collection_params', $query_params, $taxonomy ); } /** diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php index 4a693ba571..0b49ec8a2c 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php @@ -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 ); } }