akcjadynamicznyod 2.7.0
comment_{$old_status}_to_{$new_status}
Args 1Plik wp-includes/comment.php
Opis — z kodu źródłowego
Fires when the comment status is in transition from one specific status to another.
The dynamic portions of the hook name, $old_status, and $new_status, refer to the old and new comment statuses, respectively.
Possible hook names include:
comment_unapproved_to_approvedcomment_spam_to_approvedcomment_approved_to_unapprovedcomment_spam_to_unapprovedcomment_unapproved_to_spamcomment_approved_to_spam
Hook dynamiczny — możliwe nazwy
comment_approved_to_spamcomment_approved_to_unapprovedcomment_spam_to_approvedcomment_spam_to_unapprovedcomment_unapproved_to_approvedcomment_unapproved_to_spamParametry
| Parametr | Typ | Opis |
|---|---|---|
$comment | \WP_Comment | Comment object. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_action( 'comment_{$old_status}_to_{$new_status}', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}
// rejestracja funkcji zwrotnej
add_action( 'comment_{$old_status}_to_{$new_status}', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}Popularne w tej kategorii