wp_set_comment_status action-hookWP 1.5.0

Fires immediately after transitioning a comment's status from one to another in the database and removing the comment from the object cache, but prior to all status transition hooks.

Usage

add_action( 'wp_set_comment_status', 'wp_kama_set_comment_status_action', 10, 2 );

/**
 * Function for `wp_set_comment_status` action-hook.
 * 
 * @param string $comment_id     Comment ID as a numeric string.
 * @param string $comment_status Current comment status. Possible values include 'hold', '0', 'approve', '1', 'spam', and 'trash'.
 *
 * @return void
 */
function wp_kama_set_comment_status_action( $comment_id, $comment_status ){

	// action...
}
$comment_id(string)
Comment ID as a numeric string.
$comment_status(string)
Current comment status. Possible values include 'hold', '0', 'approve', '1', 'spam', and 'trash'.

Changelog

Since 1.5.0 Introduced.

Where the hook is called

wp_set_comment_status()
wp_set_comment_status
wp_delete_comment()
wp_set_comment_status
wp-includes/comment.php 2454
do_action( 'wp_set_comment_status', $comment->comment_ID, $comment_status );
wp-includes/comment.php 1508
do_action( 'wp_set_comment_status', $comment->comment_ID, 'delete' );

Where the hook is used in WordPress

wp-includes/comment.php 2418
add_action( 'wp_set_comment_status', 'wp_new_comment_notify_postauthor' );