WP HOOKS
filtrdynamicznyod 4.7.0

rest_prepare_{$this->taxonomy}

Args 3Plik wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

Opis — z kodu źródłowego

Filters the term data for a REST API response.

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

  • rest_prepare_category
  • rest_prepare_post_tag Allows modification of the term data right before it is returned.

Hook dynamiczny — możliwe nazwy

rest_prepare_categoryrest_prepare_post_tag

Parametry

ParametrTypOpis
$response\WP_REST_ResponseThe response object.
$item\WP_TermThe original term object.
$request\WP_REST_RequestRequest used to generate the response.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'rest_prepare_{$this->taxonomy}', 'twoja_funkcja', 10, 3 );

function twoja_funkcja($param_1, $param_2, $param_3) {
	// Twój kod
}

Popularne w tej kategorii