🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

Sliding Unlock Submit Comment Plugin_One Trick to Block WordPress Spam Comments

Building Your Own Websiteespecially an English-language site, it is very susceptible to spam comment harassment. You might receive dozens or even hundreds of English comments with links submitted to your website's backend for review daily. This article teaches you how to simply block these spam comments without accidentally affecting legitimate ones. For example, spam comments like the one shown in the image below:垃圾评论Don't think your website content is popular; in reality, these comments are sent by bots, and no one has actually visited your site.

Introduction and Download of the Slide-to-Unlock Comment Plugin

Install WordPressBy default, it will install anAkismet 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.
  • Secondly, these spam comments are still submitted to your website's database, causing database bloat.
Therefore, Naiba brings you a very convenientslide-to-unlock comment submission plugin, myqaptcha.The working mode of this spam comment blocking plugin named myqaptcha is very simple: it inserts a slider into your comment box. You need to drag it from left to right to activate the comment function. As demonstrated in the image below, you've likely seen and used this plugin on many blogs.评论滑动解锁 Advantages of myqaptchaCompared to Akismet Anti-Spam, the advantages of myqaptcha are more evident:
  • Small, only about 20 KB.
  • Clean, does not insert into the database.
  • Effective, requires sliding to unlock before submitting a comment, blocking bot comments.
myqaptcha DownloadClick the button below, upload it to your website for installation, and it will work automatically once activated.Download Link

Code 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 that you must not use this on your Foreign Trade Independent Website, otherwise all comments from foreigners will be 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 code above into your theme's functions file.

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step.

「Naibabiji WordPress Website Building Coaching Service」—From choosing a domain and buying hosting, to installing a Theme and publishing content, I「ll coach you through every step, helping you avoid detours and reach your goal directly.

👉 Learn about the Website Building Coaching Service
🔒

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.

×
二维码

Scan QR Code to Follow

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: