akcjadynamicznyod 4.7.0
rest_delete_{$this->post_type}
Args 3Plik wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
Opis — z kodu źródłowego
Fires immediately after a single post is deleted or trashed via the REST API.
They dynamic portion of the hook name, $this->post_type, refers to the post type slug.
Possible hook names include:
rest_delete_postrest_delete_pagerest_delete_attachment
Hook dynamiczny — możliwe nazwy
rest_delete_attachmentrest_delete_pagerest_delete_postParametry
| Parametr | Typ | Opis |
|---|---|---|
$post | \WP_Post | The deleted or trashed post. |
$response | \WP_REST_Response | The response data. |
$request | \WP_REST_Request | The request sent to the API. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_action( 'rest_delete_{$this->post_type}', 'twoja_funkcja', 10, 3 );
function twoja_funkcja($param_1, $param_2, $param_3) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_action( 'rest_delete_{$this->post_type}', 'twoja_funkcja', 10, 3 );
function twoja_funkcja($param_1, $param_2, $param_3) {
// Twój kod
}Popularne w tej kategorii