comment_{$old_status}_to_{$new_status}

ACTION wp-includes\comment.php (ligne 1919) github
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_approved`  - `comment_spam_to_approved`  - `comment_approved_to_unapproved`  - `comment_spam_to_unapproved`  - `comment_unapproved_to_spam`  - `comment_approved_to_spam`

Paramètres

Entrée :
$comment
Sortie :
@param WP_Comment $comment Comment object.

Utilisation

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

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

Actualités

Chargement des actualités...