{$old_status}_to_{$new_status}

ACTION wp-includes\post.php (ligne 5845) github
Fires when a post is transitioned from one status to another. The dynamic portions of the hook name, `$new_status` and `$old_status`, refer to the old and new post statuses, respectively. Possible hook names include:  - `draft_to_publish`  - `publish_to_trash`  - `pending_to_draft`

Paramètres

Entrée :
$post
Sortie :
@param WP_Post $post Post object.

Utilisation

// Ajouter une fonction au hook action '{$old_status}_to_{$new_status}'
add_action('{$old_status}_to_{$new_status}', 'ma_fonction_personnalisee', 10, 1);

function ma_fonction_personnalisee($post) {
    // Votre code ici
    error_log('Hook {$old_status}_to_{$new_status} déclenché');
}

Actualités

Chargement des actualités...