Make every comment go to the spam folder

WordPress comments exists in 4 states:

  1. 0 not approved
  2. 1 approved
  3. Trashed
  4. Spam

When a user makes a comment it will end up in the 0 not approved folder, or if it’s a spam comment directly to the spam folder.

Is it possible to send every single comment to the spam folder?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I don’t know of a way the default comment status can be changed, but there’s an action 'comment_post' that runs after comments are inserted that you could easily hook to set every new comment to have the ‘spam’ status:

function set_new_comment_to_spam($commentId) {
    wp_set_comment_status($commentId, 'spam');
}

add_action('comment_post', 'set_new_comment_to_spam', 10, 1);

Add that to your functions.php


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x