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_categoryrest_prepare_post_tagAllows modification of the term data right before it is returned.
Hook dynamiczny — możliwe nazwy
rest_prepare_categoryrest_prepare_post_tagParametry
| Parametr | Typ | Opis |
|---|---|---|
$response | \WP_REST_Response | The response object. |
$item | \WP_Term | The original term object. |
$request | \WP_REST_Request | Request 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
}
// 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