• michaelmossey

    (@michaelmossey)


    Not sure if this is the right forum, so please direct me to the correct one if necessary.

    I installed Google Recaptcha for the purposes of my contact form, but the little box shows up on every page of my website in the mobile version. Someone who audited my site speed told me a while back that it was a major bottleneck. Not sure if that’s still the case, but in any case I’d like to disable it on every page except the contact form both for aesthetic reasons and to check if it speeds up the site.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Varun

    (@varunkumarmahalingam)

    Hi @michaelmossey,

    If you’re using Contact Form 7, for instance, reCAPTCHA can be restricted to only load on the contact form by adding the following filter to your functions.php:

    add_filter(‘wpcf7_recaptcha_actions’, ‘wpcf7_recaptcha_only_contact‘);
    function wpcf7_recaptcha_only_contact( $actions ) {
    if ( is_page(‘contact’) ) { // Replace ‘contact’ with your contact page slug
    return $actions;
    }
    return array(); // Don’t load it anywhere else
    }

    Thread Starter michaelmossey

    (@michaelmossey)

    thank you!

    Thread Starter michaelmossey

    (@michaelmossey)

    My slug is ‘contact’ as you have written. And I’m using Contact Form 7. But when I added this code exactly as-is, it said that ‘wpcf7_recaptcha_actions’ as a variable doesn’t exist. Does this need other code, or what do you think I need to do?

    Varun

    (@varunkumarmahalingam)

    It should not throw that error. Google re-captcha enabled in CF7 or You are using different plugin for that?

    If it is from CF7,
    https://doactions.org/plugin/contact-form-7/5.7.7/filter/wpcf7_recaptcha_actions/

    Thread Starter michaelmossey

    (@michaelmossey)

    How do you upload screen shots here? I can show you everything I did and the current CF7 version.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.