CF7 not working when reCAPTCHA enabled with generatePress only
-
Hi,
When i enable reCAPTCHA, CF7 is not working correctly
On CF7 support i’ve read that:
“It turned out that reCaptcha v3 wasn’t working properly because my theme didn’t call the wp_head(); function in its header.php file.”Could it be the same problem with GeneratePress? I’ve tried with another theme and had the same problem so it might not be because of GeneratePress…
Could you please help me?
Mathieu
- This topic was modified 2 years, 6 months ago by m4t1eu06.
-
Hi @m4t1eu06,
GP does call
wp_head()
in the header. See here: https://github.com/tomusborne/generatepress/blob/master/header.php#:~:text=11%22%3E-,%3C%3Fphp%20wp_head()%3B%20%3F%3E,-%3C/head%3EIt would be best to reach out to the support of this plugin with regards to this issue.
Hope this clarifies!
thank you @fernandoazarcon2
I did some test
With a standard WP plugin (twenty-twenty) it works. It’s only when i activate GeneratePress so… isn’t the problem coming from GeneratePress?
I mean if i ask support from CF7 Author, he might told that it works with standard WP plugin and then that i have to reach GeneratePress author… wich is understable.So maybe it’s not because of what i spoke in my first post here but it looks like the problem comes from GeneratePress…
Can anyone help me about that please?
Here is my configuration:
– Version de WordPress : 6.0.1
– Version de PHP/MySQL : 7.4.30 / 10.3.35
– Thème utilisé : GeneratePress
– Thème URI : https://generatepress.com
– Extensions en place : Async JavaScript (2.21.08.31), Autocomplete Google Address (1.9.2), Autoptimize (3.0.4), CF7 Google Sheet Connector (4.9.2), Contact Form 7 (5.6), Contextual Related Posts (3.2.3), Cookie Notice & Compliance for GDPR / CCPA (2.3.1), Forum_wordpress_fr (4.2), Header and Footer Scripts (2.2.1), miniOrange 2 Factor Authentication (5.5.80), Pricing Table by Supsystic (1.9.7), Redirection (5.2.3), UpdraftPlus – Backup/Restore (1.22.14), Wordfence Security (7.5.11), WP-Members (3.4.4.2), WP Content Copy Protection & No Right Click (premium) (12.6), WP Super Cache (1.7.9), Yoast SEO (19.3)
– Adresse du site : https://www.presta-immo.fr
– Nom de l’hébergeur : Apache`Thank you very much
Hi there,
if i Inspect your site in the browser developers tools, i see a bunch of Javascript errors in the console ( all seem to be related to the anti right click scripts on the site ).
I would recommend you fix those issues first, as one broken Javascript can lead to other scripts ( like Recaptcha ) to not work.
This may be a case that the Autoptimize or WP Cache plugin has ‘cached’ a bad script.
Changing the Theme would have been a significant enough change to have cleared that cache.To troubleshoot disable those plugins.
given the “jQuery is not defined” error and the fact jQuery (and some other JS files) have the async flag, the issue is likely (also) with the Async Javascript plugin which is configure to
async
, try switching todefer
instead and/ or exclude jQuery from being asynced/ deferred maybe?frank (ao & asyncjs dev)
Thank you @optimizingmatters , you were right.
Thank you @diggeddy for your helpI still have one single error left. I don’t know if it’s important or no
But…
i still have my reCAPTCHA / CF7 problem :/Here is a reminder:
When i enable reCAPTCHA, CF7 is not working correctly and, with a standard WP theme(twenty-twenty), it worksAny idea please?
Thank youI still have one single error left. I don’t know if it’s important or no
It is not good to have scripts errors in your site. It can mean other scripts that are loaded after the error may not work. It may also impact other Javascript actions on your site.
Regarding CF7:
Can you explain what the issue is when you enable recaptcha ?
And can you enable recaptcha so we can see the problem ?Thanks @diggeddy for your help
I will keep solving the scripts errorsRegarding CF7:
When recaptcha is enable, only connected (authentified) people can send me a message through CF7 (https://www.presta-immo.fr/contacter/ )
When i visit my website in private navigation moode (Chrome / so “not authentified to my website”) and i try to send a message at this very same page, i have an error message (i translate french: “error while attempting to send message, please try later or contact administrator)To avoid massive spam i blocked the contact page but for you to make test, i’ve unlocked it now.
Thank you
With recaptcha enabled i see this error in your console:
Uncaught ReferenceError: grecaptcha is not defined
And it is pointing to the script in Autoptimize.
If you disable autoptimize does it work correctly ?There is a related topic here on that error:
https://wordpress.org/support/topic/uncaught-referenceerror-grecaptcha-is-not-defined-4/
pro-tip; you can disable Autoptimize on a per-request basis by adding
?ao_noptimize=1
to the URL.if the problem is not there at that point, some autoptimize (re-)configuration might be needed to fix this (likely at JS optimization level, I still see the jQuery errors), for that you can follow steps outlined in https://blog.futtta.be/2022/05/05/what-to-do-when-autoptimize-breaks-your-site/ 🙂
hope this helps debugging,
frankThanks i did some test
so you are right, i have
Uncaught ReferenceError: grecaptcha is not defined
and
Uncaught ReferenceError: jQuery is not defined
both of them point to the script in Autoptimize
But
If I disable the plugin Async Javascript, i don’t have those errors anymore and CF7 works fine with recaptcha
🙂Thanks to you, i know it is a problem between those 2 plugins. I’m gonna ask to the authors now.
Thank you very much for your efficient help
I’m gonna ask to the authors now.
you’ll have to exclude jQuery & the Google captcha JS from being asynced/ deferred 🙂
@optimizingmatters
Thanks,
so i guess i have to do like that:But what about excluding google captcha JS, please?
Adding
recaptcha/api.js
to the exclusion list in AsyncJS should do the trick 🙂👏🎉🎉🎉🎉🎉
Guys!
It works!!
Thanks to you!! and thank you for the quick replyI still have a last error message:
js?key=AIzaSyBemH-WY0R7-IhmZBQqgCffMoqyDeoqGAY&libraries=places&ver=1.0:345
GET https://maps.googleapis.com/maps/api/mapsjs/gen_204?csp_test=true net::ERR_BLOCKED_BY_CLIENT
Do you know what i can do or who i can ask please?
Thanks!Glad to hear thats working.
the
net::ERR_BLOCKED_BY_CLIENT
means your browser ( ie. the CLIENT ) is blocking that request. Which generally means you have a browser extension, eg. Ad Blockers installed on your browser.
- The topic ‘CF7 not working when reCAPTCHA enabled with generatePress only’ is closed to new replies.