comment_post WordPress Action Hook

The comment_post hook is triggered whenever a comment is posted. It allows you to take an action whenever a comment is posted, such as notifying the author or sending a notification email.

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_ID

(int)The comment ID.

$comment_approved

(int|string)1 if the comment is approved, 0 if not, 'spam' if spam.

$commentdata

(array)Comment data.


Top ↑

Source

File: wp-includes/comment.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.5.0The $commentdata parameter was added.
1.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More