Action hook 'spammed_comment'

in WP Core File wp-includes/comment.php at line 1710

View Source

spammed_comment

Action Hook
Description
Fires immediately after a comment is marked as Spam.

Hook Information

File Location wp-includes/comment.php View on GitHub
Hook Type Action
Line Number 1710

Hook Parameters

Type Name Description
int $comment_id The comment ID.
WP_Comment $comment The comment marked as spam.

Usage Examples

Basic Usage
<?php
// Hook into spammed_comment
add_action('spammed_comment', 'my_custom_function', 10, 2);

function my_custom_function($comment_id, $comment) {
    // Your custom code here
}

Source Code Context

wp-includes/comment.php:1710 - How this hook is used in WordPress core
<?php
1705  		 * @since 4.9.0 Added the `$comment` parameter.
1706  		 *
1707  		 * @param int        $comment_id The comment ID.
1708  		 * @param WP_Comment $comment    The comment marked as spam.
1709  		 */
1710  		do_action( 'spammed_comment', $comment->comment_ID, $comment );
1711  
1712  		return true;
1713  	}
1714  
1715  	return false;

PHP Documentation

<?php
/**
		 * Fires immediately after a comment is marked as Spam.
		 *
		 * @since 2.9.0
		 * @since 4.9.0 Added the `$comment` parameter.
		 *
		 * @param int        $comment_id The comment ID.
		 * @param WP_Comment $comment    The comment marked as spam.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.