filtrdynamicznyod 5.4.0
rest_{$this->post_type}_item_schema
Args 1Plik wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
Opis — z kodu źródłowego
Filters the post's schema.
The dynamic portion of the filter, $this->post_type, refers to the post type slug for the controller.
Possible hook names include:
rest_post_item_schemarest_page_item_schemarest_attachment_item_schema
Hook dynamiczny — możliwe nazwy
rest_attachment_item_schemarest_page_item_schemarest_post_item_schemaParametry
| Parametr | Typ | Opis |
|---|---|---|
$schema | array | Item schema data. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_filter( 'rest_{$this->post_type}_item_schema', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}
// rejestracja funkcji zwrotnej
add_filter( 'rest_{$this->post_type}_item_schema', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}Popularne w tej kategorii