akcjadynamicznyod 2.7.0
comment_{$new_status}_{$comment->comment_type}
Args 2Plik wp-includes/comment.php
Opis — z kodu źródłowego
Fires when the status of a specific comment type is in transition.
The dynamic portions of the hook name, $new_status, and $comment->comment_type, refer to the new comment status, and the type of comment, respectively.
Typical comment types include 'comment', 'pingback', or 'trackback'.
Possible hook names include:
comment_approved_commentcomment_approved_pingbackcomment_approved_trackbackcomment_unapproved_commentcomment_unapproved_pingbackcomment_unapproved_trackbackcomment_spam_commentcomment_spam_pingbackcomment_spam_trackback
Hook dynamiczny — możliwe nazwy
comment_approved_commentcomment_approved_pingbackcomment_approved_trackbackcomment_spam_commentcomment_spam_pingbackcomment_spam_trackbackcomment_unapproved_commentcomment_unapproved_pingbackcomment_unapproved_trackbackParametry
| Parametr | Typ | Opis |
|---|---|---|
$comment_id | string | The comment ID as a numeric string. |
$comment | \WP_Comment | Comment object. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_action( 'comment_{$new_status}_{$comment->comment_type}', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_action( 'comment_{$new_status}_{$comment->comment_type}', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}Popularne w tej kategorii