wp_spam_comment()
Moves the specified comment to Spam (marks the comment as spam).
See also the similar function: wp_trash_comment().
Uses: wp_set_comment_status()
Hooks from the function
Returns
true|false. true if the comment was successfully moved to spam and false on failure.
Usage
wp_spam_comment( $comment_id );
- $comment_id(integer/WP_Comment) (required)
- ID/object of the comment to be moved to spam.
Examples
#1 Send comment with ID 3 to spam
$comm_id = 3;
$spammed = wp_spam_comment( $comm_id );
if( $spammed ){
echo 'Comment sent to spam.'
}
Changelog
| Since 2.9.0 | Introduced. |