WordPress spam hack
October 5th, 2011 by David Bradley >> No Comments
Rather than have spam comments that contain my blacklisted words be sent to the spam folder in WordPress, I’d prefer the many thousands that arrive each year containing such noise to be imediately deleted. As such, this little tweak to one’s “wp-includes/comment.php” file will do the trick: Auto-delete blacklisted spam.
Alternatively, if you feel more secure sending them to trash in case of false positives then this tweak will do that: Blacklisted spam to trash PHP tweak.
The second alternative tweak allows you to have blacklisted words about which you might blog at some point and so be able to retrieve comments from the trash that have been discarded inadvertently. E.g. I might write a blog post about the science of gambling addiction, but wouldn’t want comments that legitimately mention casinos to be deleted in this context, but would like them to be trashed if they’re spamming. The second alternative is not too different from the way Akismet spam filtering works right now, except it separates out blacklisted from Akismet filtered, which can have its uses and allow you to build a better blacklist.
Please proceed with caution and make sure you have backed up your blog and the files that require changes before you make the required mods.

"Deceived Wisdom: Why What You Thought Was Right Is Wrong" from David Bradley. Available now on 

