Google's reCAPTCHA The service can protect your site from spam and other types of automated abuse. Use Contact Form 7. 插件"Small partners all know it has integrated reCAPTCHA verification functionality, which allows us to use this functionality to block harmful forms submitted by spam robots. However, since the reCAPTCHA API uses Google's link address, and due to policy reasons, Google addresses are blocked in China, many small partners are unable to use this functionality on domestic servers to prevent robots from sending spam emails. Today, Winning Network is here to teach you all how to solve the problem of not being able to use reCAPTCHA verification functionality in China.
We want to find the file that calls the reCAPTCHA API in the Contact Form 7 plugin.
/contact-form-7/includes/recaptcha.php /contact-form-7/modules/recaptcha.php File, we use the editing tool to open this file, and find the following link addresses and replace them:
One, find the front-end JS src, approximately around line 30, change:
https://www.google.com/recaptcha/api.js
修改
https://www.recaptcha.net/recaptcha/api.js
Two, find the backend API address, approximately around line 369, change:
https://www.google.com/recaptcha/api/siteverify
修改
https://www.recaptcha.net/recaptcha/api/siteverify
Modified after completion, upload to the server. At this point, we can successfully use the Google reCAPTCHA verification function in the Contact Form 7 plugin on our website hosted on a domestic server. Translated to American English: Modified after completion, upload to the server. At this point, we can successfully use the Google reCAPTCHA verification function in the Contact Form 7 plugin on our website hosted on a domestic server.
However, careful friends will discover that because the Contact Form 7 plugin integrates Google reCAPTCHA verification function, version V3, which will appear as a small reCAPTCHA logo in the lower right corner of all website pages:
This reCAPTCHA logo will affect the aesthetics of our site and also conflict with our site's bottom-right corner “返回顶部” or “客服” buttons, so let's hide it! We just need to add the following code to our defined CSS style sheet:
Translated to American English: This reCAPTCHA logo will affect the aesthetics of our site and also conflict with our site's bottom-right corner "Return to Top" or "Customer Service" buttons, so let's hide it! We just need to add the following code to our defined CSS style sheet:.grecaptcha-badge { visibility: hidden; }
This way, this reCAPTCHA logo will be completely hidden and will no longer affect the beauty of our page! How about it, friends? Have all of your domestic sites used this function now?