Inserts a comment into the database.
Insère un commentaire dans la base de données.
$commentdata
Sortie :
@param array $commentdata {
@return int|false The new comment's ID on success, false on failure.
add_action('wp_insert_comment', 'on_new_comment', 10, 2);
function on_new_comment($comment_id, $comment) {
if ($comment->comment_approved === 'spam') {
wp_spam_comment($comment_id);
return;
}
if ($comment->user_id > 0) {
wp_set_comment_status($comment_id, 'approve');
}
}
Chargement des actualités...