W3cubDocs

/WordPress

do_action( ‘comment_post’, int $comment_id, int|string $comment_approved, array $commentdata )

Fires immediately after a comment is inserted into the database.

Parameters

$comment_idint
The comment ID.
$comment_approvedint|string
1 if the comment is approved, 0 if not, 'spam' if spam.
$commentdataarray
Comment data.

Source

do_action( 'comment_post', $comment_id, $commentdata['comment_approved'], $commentdata );

Changelog

Version Description
4.5.0 The $commentdata parameter was added.
1.2.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/comment_post