delete_post_{$post->post_type}

ACTION wp-includes\post.php (ligne 3896) github
Fires immediately before a post is deleted from the database. The dynamic portion of the hook name, `$post->post_type`, refers to the post type slug.

Paramètres

Entrée :
$post_id, $post
Sortie :
@param int     $post_id Post ID.
@param WP_Post $post    Post object.

Utilisation

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

function ma_fonction_personnalisee($post_id, $post) {
    // Votre code ici
    error_log('Hook delete_post_{$post->post_type} déclenché');
}

Actualités

Chargement des actualités...