do_action( “comment_{$new_status}_{$comment->comment_type}”, string $comment_id, WP_Comment $comment )

In this article

Fires when the status of a specific comment type is in transition.

Description

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

Parameters

$comment_idstring
The comment ID as a numeric string.
$commentWP_Comment
Comment object.

Source

do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );

Changelog

VersionDescription
2.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.