rest_prepare_taxonomy filter-hookWP 4.7.0

Filters a taxonomy returned from the REST API.

Allows modification of the taxonomy data right before it is returned.


add_filter( 'rest_prepare_taxonomy', 'wp_kama_rest_prepare_taxonomy_filter', 10, 3 );

 * Function for `rest_prepare_taxonomy` filter-hook.
 * @param WP_REST_Response $response The response object.
 * @param WP_Taxonomy      $item     The original taxonomy object.
 * @param WP_REST_Request  $request  Request used to generate the response.
 * @return WP_REST_Response
function wp_kama_rest_prepare_taxonomy_filter( $response, $item, $request ){

	// filter...
	return $response;
The response object.
The original taxonomy object.
Request used to generate the response.


Since 4.7.0 Introduced.

Where the hook is called

wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php 291
return apply_filters( 'rest_prepare_taxonomy', $response, $taxonomy, $request );

Where the hook is used in WordPress

Usage not found.