filtrdynamicznyod 4.7.0
rest_{$this->post_type}_trashable
Args 2Plik wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
Opis — z kodu źródłowego
Filters whether a post is trashable.
The dynamic portion of the hook name, $this->post_type, refers to the post type slug.
Possible hook names include:
rest_post_trashablerest_page_trashablerest_attachment_trashablePass false to disable Trash support for the post.
Hook dynamiczny — możliwe nazwy
rest_attachment_trashablerest_page_trashablerest_post_trashableParametry
| Parametr | Typ | Opis |
|---|---|---|
$supports_trash | bool | Whether the post type support trashing. |
$post | \WP_Post | The Post object being considered for trashing support. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'rest_{$this->post_type}_trashable', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'rest_{$this->post_type}_trashable', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}Popularne w tej kategorii