It is easy to stop most WordPress comment spam instantly with one small change to your theme’s functions.php. This is one of my favourite WordPress functions and I use it on all my setups.
This code snippet works by blocking comments from being added offsite or indirectly and not from the comment box on your webpage.
Just to prove this works - take a look at your spam comments now and mentally calculate your daily average of new spam comments. Then after adding this script wait for 24 hours - if your spam comments are not way down or close to zero you’ve done something wrong.
The role of WordPress functions.php
Your functions.php file is the place to add snippets of code just like this. Remember to keep a copy incase you have to update or replace your theme.
Stop WordPress Comment Spam
Go to your theme folder and open functions.php and insert this code
//Damiens favourite function to stop comment spam.
function verify_comment_referer() { if (!wp_get_referer()) { wp_die( __('You cannot post comment at this time, may be you need to enable referrers in your browser.') ); } } add_action('check_comment_flood', 'verify_comment_referer');
Do you like this? Did this work for you?
Check back later for more helpful suggestions.
See Also: Clickon5.org
Tags:Read more from my blog for an introduction and quick tips on developing in Hugo or UCTD.