• Resolved resortstylebeanbags

    (@resortstylebeanbags)


    I have cloudflare turnstile on my wpforms form on my site. On desktop it works as expected. But on mobile, turnstile fails the user, and customers cannot submit a form/enquiry. If I deactivate the Siteground Optimizer plugin, turnstile works as expected on mobile and the customer can submit the form.

    When Optimizer is enabled, I get the message “Cloudflare Turnstile verification failed, please try again later.”

    More specifically, leaving the SG Optimizer plugin activated, and turning off the Combine javascript files option also fixed the issue.

    I tried adding the clouflare script to excludes using the below, but not sure if that is the correct handle for the script, or if that is even the script that should be excluded:

    add_filter( 'sgo_javascript_combine_exclude', 'js_combine_exclude' );
    function js_combine_exclude( $exclude_list ) {
        $exclude_list[] = 'cloudflare-turnstile';
        return $exclude_list;
    }

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support kuzmanstoyanov

    (@kuzmanstoyanov)

    Hello @resortstylebeanbags,

    I was able to recreate the issue on a test website. It is caused by the “Combine JavaScript Files” feature. The solution would be to exclude the Turnstile JS script from being combined.

    Please, add the following code to the functions.php file of your active theme:

    add_filter( 'sgo_javascript_combine_excluded_external_paths', 'js_combine_exclude_external_script' );
    function js_combine_exclude_external_script( $exclude_list ) {
        $exclude_list[] = 'challenges.cloudflare.com';
    
        return $exclude_list;
    }

    If you need assistance in adding the code to your site, please open a Helpdesk request from your SiteGround Client Area.

    Best Regards,
    Kuzman Stoyanov

    Thread Starter resortstylebeanbags

    (@resortstylebeanbags)

    Thanks Kuzman,

    I added the code and it fixed the issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cloudflare Turnstile on WPForm’ is closed to new replies.