Spam is a pain in the butt, but we bloggers have to deal with it on a daily basis. WordPress is as bad about spam as any other CMS, but there are a variety of options to help weed out the spammy nuisance. The most popular plug-in is Akismet, which most WordPress bloggers already take advantage of, but it doesn’t do near as much as most of us would like.
Instead of relying on Akismet, it is best to have a multifaceted defense that helps keep spam of all sorts out of the picture. Cats Who Code recently shared a list of snippets and “hacks” all aimed specifically at erasing spam management from your WordPress responsibilities. I’m sharing the different ways you can deal with the spam issue that have been highlighted in their article, but if you want the code for a specific solution, they are all available on their blog.
One method involves targeting any and all comments with extra long urls. If you haven’t noticed, most spam comments come with super long urls, which make them easy targets once you know what you’re looking for. But, there is a code you can paste into your functions.php file that marks any comment with a url over 50 characters as spam.
Similarly, you may also notice that most legitimate commenters are perfectly happy to not include any url at all. They are there to join the conversation, not sell their own site after all. This means you can fight spam simply by removing the url field from your comment form. Some commenters won’t be too excited about the change, as it is nice to get an added boost to your site simply by sharing your expertise on other blogs, but most won’t be too hurt by the decision.
Spammers are very predictable, and the most common trick they use is targeting specific keywords. As such, creating a keyword blacklist that uses the most frequently targeted keywords for spam will allow you to mark any comments using a mess of the target keywords as spam. It is a more focused approach than those above, but it can also affect commenters who just happen to use important keywords in their responses.
You have many more options when it comes to fighting spam, but it is best to take a look at the spam you’ve already been dealing with, so that you will know exactly what you’re dealing with before you start blocking tons of comments for every spammy tactic. You don’t want to accidentally weed out legitimate commenters while you’re on your anti-spam war path.