WP HOOKS
filtrdynamicznyod 4.7.0

rest_{$this->taxonomy}_query

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

Opis — z kodu źródłowego

Filters get_terms() arguments when querying terms via the REST API.

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

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

Hook dynamiczny — możliwe nazwy

rest_category_queryrest_post_tag_query

Parametry

ParametrTypOpis
$prepared_argsarrayArray of arguments for get_terms().
$request\WP_REST_RequestThe REST API request.

Wywołanie

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

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

Popularne w tej kategorii