By default, the WP 'blacklist' feature finds comments containing the blacklisted string and moves them to the spam folder. What I am trying to do is change it so that instead of going to spam, the comment goes directly to the trash (or even better isn't stored at all).

In /wp-includes/comment.php around line 700:

if ( wp_blacklist_check($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent) )
    $approved = 'spam';

I tried modifying the line to $approved = 'trash'; but I am still getting comments containing blacklisted words being moved to my spam folder. The only comment related plugin I am running in Akismet, is it possible that Akismet is moving the comment to spam before comment.php processes it?

  • I can't swear to it, but yes that is a plausible theory. – s_ha_dum Feb 21 '13 at 5:25
  • @s_ha_dum The Akismet theory? I will try disabling it for a bit and see if there is any change. – Josh Mountain Feb 21 '13 at 5:31

As I suspected originally, it would appear that Akismet is dealing with the comments before comment.php gets a chance, and thus they avoid the blacklist check entirely. After disabling Akismet the comments are moved to the trash as they should be.

  • 1
    There are a fair number of Akismet hooks that you may want to look into. – s_ha_dum Feb 21 '13 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.