I thought this might be helpful to anyone trying to use Recatcha V2 in Webflow with a serverside PHP script for form handling. Once you sign up for Recaptcha V2 on Google’s site, you must add an embed element to your Webflow form to hold the Google code snippet. Google says to give the element a class name of ‘g-recaptcha’ but I noticed that Webflow appends ’ w-embed’ to the class name behind the scenes. This prevents the Recaptcha widget from appearing in your form. Here is what I did to get this to work:
- Add an embed element to your Webflow form where you want the Recaptcha widget to appear.
- Give the embed element a class name of ‘g-recaptcha w-embed’.
- Paste the Google code snippet into the embed element, and edit the code by changing the class name from ‘g-recaptcha’ to ‘g-recaptcha w-embed’, and entering your SiteKey.
- Edit the page (gear icon) and paste the following code inside the head tag:
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
The widget should now appear in your form (Note: You can add ‘YourSite.webflow.io’ to your Recaptcha settings in Google to make testing easier).
Next you’ll need to modify the PHP script that handles the form processing. I found the following link very helpful:
I hope this helps!