akcjadynamicznyod 2.3.0
{$old_status}_to_{$new_status}
Args 1Plik wp-includes/post.php
Opis — z kodu źródłowego
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_publishpublish_to_trashpending_to_draft
Hook dynamiczny — możliwe nazwy
draft_to_publishpending_to_draftpublish_to_trashParametry
| Parametr | Typ | Opis |
|---|---|---|
$post | \WP_Post | Post object. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_action( '{$old_status}_to_{$new_status}', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}
// rejestracja funkcji zwrotnej
add_action( '{$old_status}_to_{$new_status}', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}Popularne w tej kategorii