![](https://i-blog.csdnimg.cn/blog_migrate/7b1e8d8110ab7fc57c2e26acad5707b6.png)
recaptcha
Are you looking to add reCAPTCHA to your WordPress comment form?
您是否正在将reCAPTCHA添加到WordPress注释表单中?
Spam comments have gotten out of control for WordPress websites. As spammers become more sophisticated, they can launch massive spam attacks with little effort.
垃圾邮件评论已失去对WordPress网站的控制。 随着垃圾邮件发送者变得越来越复杂,他们可以毫不费力地发起大规模的垃圾邮件攻击。
Akismet, the popular spam filtering service for WordPress blocks about 7.5 million spam comments every hour. Dealing with spam comments can be frustrating, and some bloggers even choose to completely disable comments on their websites.
Akismet是流行的WordPress垃圾邮件过滤服务,每小时可拦截约750万条垃圾邮件评论。 处理垃圾评论可能会令人沮丧,有些博客甚至选择完全禁用其网站上的评论 。
Instead of turning off the comments, you can add CAPTCHA to the comment form to practically eliminate spam.
无需关闭评论,您可以将CAPTCHA添加到评论表单中以实际上消除垃圾邮件。
In this tutorial, we’ll show you how to easily add reCAPTCHA to the comment form of your WordPress website.
在本教程中,我们将向您展示如何轻松地将reCAPTCHA添加到WordPress网站的评论表单中。
![Add reCAPTCHA to WordPress Comment Form Add reCAPTCHA to WordPress Comment Form](https://i-blog.csdnimg.cn/blog_migrate/702a0ed6710393fc193b7cd33eadd314.png)
什么是Google reCAPTCHA? (What is Google reCAPTCHA?)
ReCAPTCHA is an advanced form of CAPTCHA, which is a technology used to differentiate between robots and human users. CAPTCHA is an acronym for “Completely Automated Public Turing test to tell Computers and Humans Apart”.
ReCAPTCHA是CAPTCHA的一种高级形式,它是一种用于区分机器人和人类用户的技术。 CAPTCHA是“完全自动化的公共图灵测试以告诉计算机和人类的区别”的首字母缩写。
Google acquired CAPTCHA technology in 2009 and then later rebranded it as reCAPTCHA. They also made it easier for human users to easily pass the test.
Google于2009年收购了CAPTCHA技术,随后将其更名为reCAPTCHA。 它们还使人类用户更容易通过测试。
Basically, it presents users with a simple check box that they can click to pass the test. If for some reason the test doesn’t validate, then the user will be presented with a challenge identifying text in an image or matching objects in multiple images.
基本上,它为用户提供了一个简单的复选框,他们可以单击以通过测试。 如果由于某种原因该测试无法通过验证,则将向用户提出挑战,以识别图像中的文本或匹配多个图像中的对象。
Google have made reCAPTCHA publicly available, so that website owners can use it on contact forms, login pages, and comment forms to reduce spam.
Google已使reCAPTCHA公开可用,以便网站所有者可以在联系表单 , 登录页面和评论表单上使用它来减少垃圾邮件。
Here’s an example of what reCPATCHA test looks like to majority of your users:
这是大多数用户使用reCPATCHA测试的示例:
![Google reCAPTCHA tickbox Google reCAPTCHA tickbox](https://i-blog.csdnimg.cn/blog_migrate/6378a611fa04200b940b14a49f8405f7.png)
It is super easy to setup and add to the WordPress comment form.
设置并添加到WordPress注释表单非常容易。
With that said, let’s see how to easily add reCAPTCHA to the WordPress comment form with step by step instructions.
如此说来,让我们看看如何通过分步说明轻松地将reCAPTCHA添加到WordPress注释表单中。
步骤1:开始 (Step 1: Get Started)
First thing you need to do is install and activate the reCAPTCHA in WP comments form plugin. You can see our step by step guide on how to install a WordPress plugin for detailed instructions.
您需要做的第一件事是在WP注释表单插件中安装并激活reCAPTCHA 。 您可以查看有关如何安装WordPress插件的分步指南, 以获取详细说明。
Upon activation, you need to visit Settings » reCAPTCHA in Comments page to configure plugin settings.
激活后,您需要在评论页面中访问设置»reCAPTCHA以配置插件设置。
![reCaptcha plugin settings page reCaptcha plugin settings page](https://i-blog.csdnimg.cn/blog_migrate/95f50d0afab8a89c62ae8c8d7e6b072b.png)
The plugin will ask you to provide Google reCAPTCHA API keys. You can create these keys for free from the official reCAPTCHA website.
插件将要求您提供Google reCAPTCHA API密钥。 您可以从reCAPTCHA官方网站免费创建这些密钥。
第2步:注册您的网站以获得reCAPTCHA API密钥 (Step 2: Register Your Website to Get reCAPTCHA API Keys)
The plugin needs 2 Google API keys to add a reCAPTCHA checkbox to your comment form.
该插件需要2个Google API密钥才能在您的评论表单中添加一个reCAPTCHA复选框。
To get the API keys, head over to the Google reCAPTCHA website and click on the ‘Admin Console’ button located at the top right corner of the screen.
要获取API密钥,请转到Google reCAPTCHA网站 ,然后单击屏幕右上角的“管理控制台”按钮。
![Visit Google reCAPTCHA website Visit Google reCAPTCHA website](https://i-blog.csdnimg.cn/blog_migrate/47baeea0a8f0cc23b84398a4b10f7ec6.png)
You’ll be asked to sign in with your Google account. After that, you’ll see the “Register a new site” page where you need to provide some basic information to register your site.
系统会要求您使用您的Google帐户登录。 之后,您将看到“注册新站点”页面,需要在其中提供一些基本信息来注册站点。
First, you need to type your website name or any name of your choice in the Label field. This will help you easily identify your site in the future.
首先,您需要在标签字段中输入您的网站名称或您选择的任何名称。 这将帮助您将来轻松识别您的站点。
![Adding a new site Adding a new site](https://i-blog.csdnimg.cn/blog_migrate/51b1b082abdecf312149653a26bd3855.png)
Next, you need to select the reCAPTCHA V2 radio button.
接下来,您需要选择reCAPTCHA V2单选按钮。
This will open up 3 new options. Since you want to add the reCAPTCHA checkbox to your site, you need to select the “I’m not a robot checkbox” option.
这将打开3个新选项。 由于您要将reCAPTCHA复选框添加到您的站点,因此需要选择“我不是机器人复选框”选项。
The Domains textbox allows you to add the domain name of your website where you would like to add the reCAPTCHA checkbox.
通过“域”文本框,您可以在要添加reCAPTCHA复选框的位置添加网站的域名 。
You can also add multiple domains or subdomains by clicking on the plus (+) icon. This will allow you to use the same API keys on different websites.
您还可以通过单击加号( + )图标来添加多个域或子域 。 这将允许您在不同的网站上使用相同的API密钥。
![Add domain and email to reCAPTCHA site Add domain and email to reCAPTCHA site](https://i-blog.csdnimg.cn/blog_migrate/6cf950bd231deff7f254b22557f58771.png)
Under Owners, Google will already add your email address. You can also add another email if you want.
在“ 所有者”下 ,Google已经添加了您的电子邮件地址。 您还可以根据需要添加其他电子邮件。
Next, you need to accept the terms of service to use Google reCAPTCHA on your site.
接下来,您需要接受服务条款才能在您的网站上使用Google reCAPTCHA。
Also, select the “Send alerts to owners” checkbox to allow Google to send emails to you if they detect any misconfiguration or suspicious activity.
另外,选中“向所有者发送警报”复选框,以允许Google在检测到任何配置错误或可疑活动时向您发送电子邮件。
![Submit and register your WordPress site Submit and register your WordPress site](https://i-blog.csdnimg.cn/blog_migrate/28ad391266f6e589227d4aa5053d80ed.png)
Once you’ve filled the form, you can click on the Submit button to register your site.
填写表格后,您可以单击“ 提交”按钮来注册您的网站。
Google reCAPTCHA will now show you a success message along with the site key and the secret key on this page.
Google reCAPTCHA现在将在此页面上向您显示成功消息以及站点密钥和秘密密钥。
![Copy site and secret keys Copy site and secret keys](https://i-blog.csdnimg.cn/blog_migrate/60ae6f6cf9cc2a331e3429288f218fd7.png)
You can now use these API Keys in plugin settings on your website.
现在,您可以在网站上的插件设置中使用这些API密钥。
步骤3:将reCAPTCHA添加到WordPress评论表单 (Step 3: Add reCAPTCHA to WordPress Comment Form)
Head over to Settings » reCAPTCHA in Comments from the left sidebar of your admin panel.
从管理面板的左侧栏中,转到“ 注释 ”中的“设置” » reCAPTCHA 。
On the settings page, you need to scroll down to paste the site key and the secret key.
在设置页面上,您需要向下滚动以粘贴站点密钥和秘密密钥。
![Add Google API keys to WordPress site Add Google API keys to WordPress site](https://i-blog.csdnimg.cn/blog_migrate/389ec477eb6f4288607ddf9339e3d5e3.png)
Once you’re done, click on the “Save your Google reCAPTCHA API Keys pair” button to store the API keys.
完成后,单击“保存Google reCAPTCHA API密钥对”按钮以存储API密钥。
The last thing you need to do is enable reCAPTCHA by clicking on the toggle button and then click on Save Changes.
您需要做的最后一件事是通过单击切换按钮,然后单击“ 保存更改”来启用reCAPTCHA。
![Activate Google reCAPTCHA on your site Activate Google reCAPTCHA on your site](https://i-blog.csdnimg.cn/blog_migrate/5032ff862a39a395369b83771cb5c922.png)
You can also do basic customization by clicking on the reCAPTCHA Customizer option.
您还可以通过单击reCAPTCHA Customizer选项进行基本的自定义 。
![Customize reCAPTCHA appearance Customize reCAPTCHA appearance](https://i-blog.csdnimg.cn/blog_migrate/e40dcc6fb3b0c7aeadd739fa7d3ebcc6.png)
Here you can make changes to the style, size, and alignment of the reCAPTCHA checkbox.
在这里,您可以更改reCAPTCHA复选框的样式,大小和对齐方式。
The plugin also has Antispam Settings option which allows you to decide what to do when the plugin detects an unauthorized comment or security breach.
该插件还具有“ 反垃圾邮件设置”选项,该选项可让您决定当插件检测到未经授权的评论或安全漏洞时该怎么做。
![What to do with spam comments What to do with spam comments](https://i-blog.csdnimg.cn/blog_migrate/17fcb0dddedf0260b2ac4f8aa9668e7a.png)
Congratulations, you’ve successfully added reCAPTCHA to your WordPress comment form. You can now check the comment section of your blog posts to confirm that it’s working properly.
恭喜,您已成功将reCAPTCHA添加到WordPress注释表单中。 现在,您可以检查博客文章的评论部分,以确认它是否正常运行。
Note: the reCAPTCHA checkbox will be displayed only to logged out users, so you will need to either log out or open your website in an Incognito window of your browser to preview reCAPTCHA.
注意: reCAPTCHA复选框仅向注销用户显示,因此您需要注销或在浏览器的“隐身”窗口中打开网站才能预览reCAPTCHA。
![WordPress comment form with reCAPTCHA enabled WordPress comment form with reCAPTCHA enabled](https://i-blog.csdnimg.cn/blog_migrate/ca2f28995e9d9fe8ffe422b08acb8d91.png)
We hope this tutorial helped you learn how to add reCAPTCHA to the WordPress comment form of your website.
我们希望本教程可以帮助您学习如何将reCAPTCHA添加到网站的WordPress评论表单中。
You may also want to check out our guide on how to lazy load comments in WordPress to improve the page loading time.
您可能还需要查看我们的指南, 了解如何在WordPress中延迟加载注释以缩短页面加载时间。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在Twitter和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/plugins/how-to-add-recaptcha-to-wordpress-comment-form/
recaptcha