rest_delete_{$this->post_type}

ACTION wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php (ligne 1197) github
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`

Paramètres

Entrée :
$post, $response, $request
Sortie :
@param WP_Post          $post     The deleted or trashed post.
@param WP_REST_Response $response The response data.
@param WP_REST_Request  $request  The request sent to the API.

Utilisation

// Ajouter une fonction au hook action 'rest_delete_{$this->post_type}'
add_action('rest_delete_{$this->post_type}', 'ma_fonction_personnalisee', 10, 1);

function ma_fonction_personnalisee($post, $response, $request) {
    // Votre code ici
    error_log('Hook rest_delete_{$this->post_type} déclenché');
}

Actualités

Chargement des actualités...