Every blogger knows that comment spam is such a pain. Akismet is good solution, but not always. Why not to block spammers, instead of mark them as spam or suspicious as a spam. The code below looks for HTTP reffere in the request header and blocks the comments if the reffer is wrong or not defined.
Insert the following code in functions.php file of current theme:
function check_referrer() {
if (!isset($_SERVER['HTTP_REFERER']) || $_SERVER['HTTP_REFERER'] == "") {
wp_die( __('Please enable referrers in your browser, or, if you\'re a spammer, get lost!') );
}
}
add_action('check_comment_flood', 'check_referrer');
Explanation.
The code rejects any comment request posting from a browser that has no reffer. Usually it is a bot. The code checks the for ‘HTTP_REFERRE’. If it’s not defined or incorrect, the execution is stopped with the appropriate message.
Enjoy!
Tags: eliminate comment spam, eliminate spam, eliminate spam comment, eliminate wordpress comment spam
Leave a trackback from your own site.
Leave a Reply
You must be logged in to post a comment.
4 Responses to “Eliminate Comment Spam”
Use this link to submit post Eliminate Comment Spam > http://wordpress-tech.info/eliminate-comment-spam.html
Very usefull tip: Eliminate Comment Spam
To get updates in Technology visit here :
It’s actually a cool and helpful piece of info. I am happy that you shared this useful information with us. Please keep us up to date like this. Thanks for sharing.