function wp_spam_comment($comment_id) {}

Marks a comment as Spam


  • int $comment_id: Comment ID.

Return values

returns:False on failure

Defined actions

  • spam_comment
    do_action('spam_comment', $comment_id);
  • spammed_comment
    do_action('spammed_comment', $comment_id);

Source code

function wp_spam_comment($comment_id) {

	if ( !$comment = get_comment($comment_id) )

		return false;

	do_action('spam_comment', $comment_id);

	if ( wp_set_comment_status($comment_id, 'spam') ) {

		add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved);

		do_action('spammed_comment', $comment_id);

		return true;


	return false;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: