comment_{$new_status}_{$comment->comment_type}

ACTION wp-includes\comment.php (ligne 1946) github
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_comment`  - `comment_approved_pingback`  - `comment_approved_trackback`  - `comment_unapproved_comment`  - `comment_unapproved_pingback`  - `comment_unapproved_trackback`  - `comment_spam_comment`  - `comment_spam_pingback`  - `comment_spam_trackback`

Paramètres

Entrée :
$comment->comment_ID, $comment
Sortie :
@param string     $comment_id The comment ID as a numeric string.
@param WP_Comment $comment    Comment object.

Utilisation

// Ajouter une fonction au hook action 'comment_{$new_status}_{$comment->comment_type}'
add_action('comment_{$new_status}_{$comment->comment_type}', 'ma_fonction_personnalisee', 10, 1);

function ma_fonction_personnalisee($comment->comment_ID, $comment) {
    // Votre code ici
    error_log('Hook comment_{$new_status}_{$comment->comment_type} déclenché');
}

Actualités

Chargement des actualités...