Akismet is the most powerful plugin to separate the genuine comments from those who look like spam. It puts the suspected spam comments in a ‘Spam’ bucket rather than your ‘Pending’ or ‘Approved’ comments queue. But what if you get hundred of suspected comment spam everyday due to spammers and comment posting bots, and now to check whether they are actual spam or some genuine comment is put mistakenly due to some statistics to spam is a real overhead. In this case, the only way left is to delete the comment spam directly without checking the sanity. And may be you could lose some valuable comments also in this case. So, wouldn’t it be better if you let Akismet check the comments for spam only when they come from your own blog post or page i.e. the comment is posted by some individual site visitor and not some program bot.
You can either use a WordPress plugin called ‘Math Comment Spam Protection’ for this purpose. But if you are using WP-Super Cache, Math Comment Spam Protection has some issues that the sum does not match and normal visitors are also not allowed to post comments to your posts.
You may also like to read ‘Your Comments Not Appearing On Other Blogs! Ask Akismet’
The easy way out to avoid spam comments entering your WordPress system is, you can just paste the below few lines of PHP code to your theme’s function.php file and you are done 🙂
The wp_get_referer function retrieves/returns the referrer from ‘_wp_http_referer’, HTTP referrer, or based on current page respectively. ‘Referrer’ stand for the address of the page (if any) which referred the user agent/browser to the current page. When the ‘referrer’ for a particular comment posting request is empty, it means that the comment is not posted from your blog page/post (as the address of the page/post which has the comment form would be referrer in this case). And the above function will forbid such comments from being entering to your WordPress blog or site. Thus, those will neither go to Akismet nor go to pending or approval queue.
This function will also reject the comments from the browsers which do not have referrers enabled, but all the browsers today have this feature, so the comments with undefined referrer requests are from nothing but bots.
This function is tied to WordPress action hook check_comment_flood which runs when the comment validation is done that whether this comment is allowed or not. After this, the comment approval status is set.
Please post your valuable suggestions and repercussions to this article in the comments section below.
Approved some of your blog comments in hurry, you may like to read ‘Cleanup Of Comments Section Of Blog Thru Simple Technique’