WP HOOKS
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_post
  • rest_delete_page
  • rest_delete_attachment

Hook dynamiczny — możliwe nazwy

rest_delete_attachmentrest_delete_pagerest_delete_post

Parametry

ParametrTypOpis
$post\WP_PostThe deleted or trashed post.
$response\WP_REST_ResponseThe response data.
$request\WP_REST_RequestThe 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
}

Popularne w tej kategorii