skip to Main Content
Menu

Adding an extra layer of protection to WordPress

Spammers are always a problem, even though there are a whole slew of plugins to protect against them. This piece of code will add an extra barrier that they have to break through. Essentially what it does is block any comment that does not have a referrer (i.e. where the user came from previously) in the posting request, which is usually indicative of bots.

Paste this into your functions.php

if (!isset($_SERVER['HTTP_REFERER']) || $_SERVER['HTTP_REFERER'] == “”) {
wp_die( __('Please enable referrers in your browser, or, if you're a spammer, get out of here!') );
}
}

add_action(‘check_comment_flood’, ‘check_referrer’);
?>

source : http://www.problogdesign.com/wordpress/advanced-wordpress-comment-styles-and-tricks/

Alphonse

Editorial Staff at ETN Multimedia is led by Alphonse Tan. Page maintained by Alphonse Tan

Back To Top