Eliminate Comment Spammers [WordPress]
If you are on Self-hosted WordPress, spam comments are very common. Though Akismet smartly filters out spam comments, if you prefer not to allow spammers from commenting, the best solution is to have a verification system similar to CAPTCHA, to verify if it’s a human or a spam-bot.
Related: Block Spammers from Visiting your Site/Blog
Instead of CAPTCHA, a simple solution would be a math-based verification wherein a commenter is asked only to answer simple math questions.
Math Comment Spam Protection plugin is one such plugin by Michael Woehrer. Download and activate the plugin. If you prefer, you can change those Error Messages from the ‘Options’ page (Settings->Math Comment Spam).
The process isn’t over yet, you’ll have to add few lines of code to comments.php
To modify comments.php, browse to /wp-content/themes/<theme-name>/comments.php on your server via FTP/cPanel/SSH. Open comments.php using a text editor (I would suggest Notepad++) and add the following lines of code.
<?php /****** Math Comment Spam Protection Plugin ******/ if ( function_exists('math_comment_spam_protection') ) { $mcsp_info = math_comment_spam_protection(); ?> <p><input type="text" name="mcspvalue" id="mcspvalue" value="" size="22" tabindex="4" /> <label for="mcspvalue"><small>Spam protection: Sum of <?php echo $mcsp_info['operand1'] . ' + ' . $mcsp_info['operand2'] . ' ?' ?></small></label> <input type="hidden" name="mcspinfo" value="<?php echo $mcsp_info['result']; ?>" /> </p> <?php } // if function_exists... ?> |
Although you can place the code before the </form> tag, the best place to have the code is after the URL textbox and before the comment text-area so that it doesn’t look odd. An intermediate HTML designer should have no difficulty in adding. If you are unsure, follow the procedure below. [Click the images below to have a larger view]
In your comments.php, scroll to the <input> tag where you get user’s website. To find it, use the search feature in your text editor and search for “$comment_author_url;” (without the quotes). The image above should help you. I’ve highlighted “$comment_author_url;” and textarea. Now, paste the code between these lines, so that it looks like
Now that you have added, save the file and upload it back to the server (to the same location, of course). This should give you something that looks like:
If you still have issues adding the code and making it to work, feel free to comment below or contact me and I’ll be pleased to help you. :)
These really work ;)
Yes, it works like charm. You’ll hardly notice spam comments once this plugin is in action ;)
Thank you for this useful tips (^_^)
Most welcome, Milana. :)
Hey Joseph our members will be thanking you. I know this is a major issue for all of us bloggers. Man sometimes I have over 70 or 80 spam comments per day it’s just crazy!
Thanks for sharing this with us!
Brian
Thank you for checking out this blog post, Brian. So happy to hear. So true, spam comments drive admins/bloggers crazy :)
Joseph, thanks for the great post. I forgot to reisntall my spam filter. I think I will search for a new math one. As for the php code, I might just add the code if I cant find a good plugin.
Pingback: How to Block Spammers/Unwanted Users from Visiting your Site