How to disable reCaptcha v3 except on Contact Form 7 pages?

I’d put the dequeue statements inside the ‘if’, replacing the $loadscripts line. No need to set the flag and then check the flag to dequeue. That might simplify the code for further debugging. Edited: suggested code corrections: function contactform_dequeue_scripts() { if (is_singular()) { $post = get_post(); if (has_shortcode($post->post_content, ‘contact-form-7’)) { wp_dequeue_script(‘contact-form-7’); wp_dequeue_script(‘google-recaptcha’); wp_dequeue_style(‘contact-form-7’); } } … Read more

Help with verifying google recaptcha in a custom form

You need to validate the reCAPTCHA immediately once you POST the form. You’re just sending a POST to the same page, so it should be done before any other handling. If it does not validate, you need to show the form again, with an error message. function recaptcha_validated(){ if( empty( $_POST[‘g-recaptcha-response’] ) ) return FALSE; … Read more

Insert Captcha Code info Any Form (Created of Plugin)

I’d say this question is mostly off-topic since it’s not WordPress-specific. Mostly, because the majority of PHP solutions out there use sessions, which will not work out-of-the-box in WordPress. Google search actually handles this question quite well. Have a look at this discussion for nice techniques. Finally, Contact Form 7 has Captcha built-in.