rest_(taxonomy)_collection_params filter-hookWP 4.7.0

Filters 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.


add_filter( 'rest_(taxonomy)_collection_params', 'wp_kama_rest_taxonomy_collection_params_filter', 10, 2 );

 * Function for `rest_(taxonomy)_collection_params` filter-hook.
 * @param array       $query_params JSON Schema-formatted collection parameters.
 * @param WP_Taxonomy $taxonomy     Taxonomy object.
 * @return array
function wp_kama_rest_taxonomy_collection_params_filter( $query_params, $taxonomy ){

	// filter...
	return $query_params;
JSON Schema-formatted collection parameters.
Taxonomy object.


Since 4.7.0 Introduced.

Where the hook is called

wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php 1193
return apply_filters( "rest_{$this->taxonomy}_collection_params", $query_params, $taxonomy );

Where the hook is used in WordPress

Usage not found.