After building your own website, especially for English websites, which are very susceptible to spam comment harassment. There may be dozens or hundreds of English comments with links submitted to your website backend for review every day. This article teaches you how to simply block these spam comments without mistakenly affecting normal comments. For example, spam comments like the one shown in the image below:

Don't think that your website content is popular; in fact, these comments are sent by bots, and others have not even visited your website.
Introduction and Download of Slide to Unlock Comment Plugin
Install WordPressBy default, it will install an
Akismet Anti-Spamspam comment plugin for you, which uses cloud data and can automatically block some spam comments. However,
the experience is not good。
- Firstly, Akismet Anti-Spam is troublesome to set up; you need to register a key to activate it before you can use it.
- Secondly, these spam comments will still be submitted to your website database, causing database bloat.
Therefore, Naiba brings you a very convenient
slide-to-unlock comment submission plugin myqaptcha. This spam comment blocking plugin, named myqaptcha, works in a very simple way: it inserts a slider into your comment box, requiring you to drag from left to right to activate the comment function. As demonstrated in the image below, I believe you have already seen and used this plugin on many people's blogs.
Advantages of myqaptchaCompared to Akismet Anti-Spam, the advantages of myqaptcha are more obvious:
- Compact, only about 20KB
- Clean, does not insert into the database
- Effective, requires sliding to unlock before submitting comments, blocking robot comments
myqaptcha DownloadClick the button below, upload it to your website for installation, and it will work automatically after activation.
Download LinkCode Version to Block All English and Japanese Comments
If you don't want to install a plugin, you can also directly use the code below to block all English and Japanese comments. However, note: do not use this on your Foreign Trade Independent Website, otherwise, foreign users' comments will be completely unable to be submitted.
//屏蔽纯英文评论和纯日文
function refused_english_comments($incoming_comment) {
$pattern = '/[一-龥]/u';
// 禁止全英文评论
if(!preg_match($pattern, $incoming_comment['comment_content'])) {
wp_die( "您的评论中必须包含汉字!" );
}
$pattern = '/[あ-んア-ン]/u';
// 禁止日文评论
if(preg_match($pattern, $incoming_comment['comment_content'])) {
wp_die( "评论禁止包含日文!" );
}
return( $incoming_comment );
}
add_filter('preprocess_comment', 'refused_english_comments');Copy and paste the above code into the Theme functions file.
Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.