Plugin Author
xootix
(@xootix)
Hello @budzynskidominik,
Please add this code to your functions.php
//dequeue google recaptcha
add_action( 'wp_enqueue_scripts', function(){
wp_dequeue_script('xoo-el-google-recaptcha');
}, 100 );
//enqueue recaptcha
add_action( 'wp_enqueue_scripts', function(){
wp_enqueue_script('xoo-el-google-recaptcha','https://www.google.com/recaptcha/api.js?onload=XooElCaptchaCallback&render=explicit"async defer',array(),XOO_EL_VERSION,true);
}, 9999 );
Thanks @xootix it helped on chrome, but the problem is still appearing at Microsoft Edge. Please Help. Additional screenshoot from console in edge:
View post on imgur.com
Plugin Author
xootix
(@xootix)
Hello @budzynskidominik
Try replacing the previous code with
//dequeue google recaptcha
add_action( 'wp_enqueue_scripts', function(){
wp_dequeue_script('xoo-el-google-recaptcha');
}, 100 );
//enqueue recaptcha
add_action( 'wp_enqueue_scripts', function(){
wp_enqueue_script('xoo-el-google-recaptcha','https://www.google.com/recaptcha/api.js?render=explicit"async defer',array(),XOO_EL_VERSION,true);
}, 9999 );
add_action( 'wp_footer', function(){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
setTimeout(function(){
window.XooElCaptchaCallback();
},500)
})
</script>
<?php
} );
@xootix It helped, but caused some errors in console. I edited it a bit so it wont show any errors – here is the code:
//dequeue google recaptcha
add_action( 'wp_enqueue_scripts', function(){
wp_dequeue_script('xoo-el-google-recaptcha');
}, 100 );
//enqueue recaptcha
add_action( 'wp_enqueue_scripts', function(){
wp_enqueue_script('xoo-el-google-recaptcha','https://www.google.com/recaptcha/api.js?render=explicit"async defer',array(),XOO_EL_VERSION,true);
}, 9999 );
add_action( 'wp_footer', function(){
if ( !is_user_logged_in() ){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
setTimeout(function(){
if ( jQuery('.xoo-el-recaptcha').length <= 0){
window.XooElCaptchaCallback();
}
},500)
})
</script>
<?php
}
} );
@xootix it still sometimes not render on android. Please help.
hello @xootix
i try your code, but still had Uncaught TypeError: grecaptcha.render is not a function
It works sometimes, i reload the page it’s ok, later not ok
Please provide a fix
Regards
Dimitri