rest_category_query filter-hookWP 4.7.0

The dynamic portion of the hook name, $this->taxonomy, refers to the taxonomy slug.

Enables adding extra arguments or setting defaults for a terms collection request.

This is one of the variants of the dynamic hook rest_(taxonomy)_query

Usage

add_filter( 'rest_category_query', 'wp_kama_rest_category_query_filter', 10, 2 );

/**
 * Function for `rest_category_query` filter-hook.
 * 
 * @param array           $prepared_args Array of arguments for get_terms().
 * @param WP_REST_Request $request       The REST API request.
 *
 * @return array
 */
function wp_kama_rest_category_query_filter( $prepared_args, $request ){

	// filter...
	return $prepared_args;
}
$prepared_args(array)
Array of arguments for get_terms().
$request(WP_REST_Request)
The REST API request.

Changelog

Since 4.7.0 Introduced.

Where the hook is called

WP_REST_Terms_Controller::get_items()
rest_category_query
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php 265
$prepared_args = apply_filters( "rest_{$this->taxonomy}_query", $prepared_args, $request );

Where the hook is used in WordPress

Usage not found.