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?

Topic comment-meta comments spam Wordpress

Category Web


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

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.