Interception of English spam reviews
Because most of the spam comments are in English, so many domestic friends in the use of Some Chinese please plug-in, it can effectively intercept the content of the text without the comment and trackback (Pingback), not to write to the database, Can effectively reduce the spam to the blog server useless use. Although it has not been updated for more than 2 years, it is still available.
In fact, can also be simplified, directly add the following code to the subject of the functions.php file, the effect is the same as using the Some Chinese:
/* refused spam
/function refused_spam_comments ($comment _data) {
$pattern = '/[one-龥]/u ';
if (!preg_match ($pattern, $comment _data[' comment_content ')) {
err (' comments must contain Chinese! ');
}
Return ($comment _data);
Add_filter (' preprocess_comment ', ' refused_spam_comments ');
@Teddysun http://teddysun.com/has been measured feedback, there is no err in WordPress (this function may be present in the theme of @ Robins). Therefore, there is no hint of information appearing. It's best to use the Wp_die function, so there's a hint. Therefore, if the above code does not take effect, you can use the following code:
/* refused spam
/function refused_spam_comments ($comment _data) {
$pattern = '/[one-龥]/u ';
if (!preg_match ($pattern, $comment _data[' comment_content '))) {
Wp_die (' comments must contain Chinese! ');
}
Return ($comment _data);
Add_filter (' preprocess_comment ', ' refused_spam_comments ');
For those who use technical means, such as GET, post, etc. do not fill in the front desk form, directly read the background program Files spam, only shielding IP to ease the same offensive, other what verification code, sliding unlock, etc. are useless.
Prohibit certain IP access
You can add in the. htaccess file:
Order Deny,allow
deny from xxx.xxx.xxx.xx
deny xxx.xxx.xxx.xx
Intercept Chinese spam comments
If a lot of spam comments are found in Chinese, then you can use the small wall tool written in Willin Kan, theoretically can be 100% shielding robot issued spam. If it is a natural person to submit comments, the wall will be in the comments submitted form add a hidden variable, if the background detection of this variable, it is identified as spam, you can choose to audit, you can directly filter out.
If the other person knows your hidden variable or uses a virtual click, you can break a small wall. But spam is a small cost and to win the matter, unless with you and spammer enemies, I believe they will not be so boring to break your little wall. And the number of robot spam accounted for the vast majority, this tool is very necessary.
Looks like Willin now do not have WordPress, the site is also maintenance, small wall code I posted below. The use method is very simple, copy to function.php file finally can. Where wall is the hidden keyword, if necessary, please change (do not change or can).
Class Anti_spam {//Create function Anti_spam () {if (!current_user_can (' level_0 ')) {add_action (' template_redirect '),
Array ($this, ' W_tb '), 1);
Add_action (' init ', array ($this, ' Gate '), 1);
Add_action (' preprocess_comment ', Array ($this, ' sink '), 1); }//the W_TB function () {if (Is_singular ()) {Ob_start (create_function (' $input ', ' Return Preg_replace ("#textar EA (. *?) Name= ([\ "\"]) comment ([\ "\]) (. +)/textarea>#", "Textarea$1name=$2wall$3$4/textarea><textarea name=\" Comment\ "cols=\" 50\ "rows=\" 4\ "style=\" display:none\ "></textarea>", $input)
); }//Check function Gate () {(!empty ($_post[' wall ']) && empty ($_post[' comment '))? $_post[' comment '] = $_po
st[' Wall ']: $_post[' spam_confirmed ' = 1;
}//Processor function sink ($comment) {if (!empty ($_post[' spam_confirmed '))) {//method one: Directly blocked, will die (), the front two diagonal lines can be deleted.
Die ();
Method Two: Mark as spam, stay in the data library to check whether the error is judged.
Add_filter (' pre_comment_approved ', create_function (', ' return ' spam; ')); /* $is_ping = In_array ($comment [' Comment_type '], array (' Pingback ', ' trackback '));
$comment [' comment_content '] = ($is _ping)? "This is pingback/trackback, and the little wall suspects it may be spam!\n". $comment [' Comment_content ']: "[the walls are judged this is spam!] \ n ".
$comment [' comment_content '];
///MG12 processing method $is _ping = In_array ($comment [' Comment_type '], array (' Pingback ', ' trackback '));
if (! $is _ping) {die ();
} return $comment;
} new Anti_spam ();
Calculate front-end processing time
Use JavaScript to take a timestamp above the input box as a global variable, get the submission time when submitting the form, subtract two times, or be considered a robot if it is less than the possible value. Judging for the robot's comments you can do it in a small wall, or you can not handle it (without consuming server resources, but not logging spam information).
Relative to the small wall, this method is more reliable, but there is no loophole, as long as spammer do a settimeout delay release will be broken.
Time stamp
The old square robot method, very practical, but has the biggest disadvantage: The user experience is not good. Ask visitors to fill in a difficult to observe the number, seriously depress commentators enthusiasm. WordPress platform There are many such plug-ins can be used, but I do not recommend the use of.