• Resolved joe16

    (@joe16)


    Hi,

    Please check the source code of this page (please check the page link section), and do a search with “hcaptcha”, you will notice all the stuff related to the plugin. According to my knowledge, these things are not meant to be loaded on every page, except for the involved pages such as the contact page (when the hCaptcha is enabled on the contact form).

    I even have this code

    function hcap_block_inline_styles() {
    if ( is_page( 'contact' ) ) {
    return;
    }

    remove_action( 'wp_head', [ hcaptcha(), 'print_inline_styles' ] );
    }
    add_action( 'wp_head', 'hcap_block_inline_styles', 0 );

    Even with this code, you can see that there are some hCaptcha stuff loaded on other pages.

    Please tell me how to prevent hCaptcha to be loaded on other pages? My purpose is to only load the scripts and related stuff only on the contact form page. Plus, I use the plugin on admin login and lost password pages.

    Looking forward to your reply. Thank you in advance.

    My best regards,

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

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor kaggdesign

    (@kaggdesign)

    Hi @joe16 ,

    Thank you for reporting. It is a bug. I have fixed it and you can download the 4.13-RC1 here.

    Thread Starter joe16

    (@joe16)

    Hi @kaggdesign,

    Thank you for your responsive support and the fix, it works!

    One last thing, there is still a DNS prefetch for //hcaptcha.com, which is useless in case of not loading the resources.

    <link rel='dns-prefetch' href='//hcaptcha.com' />

    You can see it at the top of the page source code. It would be better to only prefetch the DNS when needed and not all the time.

    Looking forward to your reply. Thank you in advance.

    My best regards,

    Plugin Contributor kaggdesign

    (@kaggdesign)

    You still need that code you provided above. The prefetch to be added early, when there is no information if a page contains hCaptcha. So, you should remove it via the filter.

    Thread Starter joe16

    (@joe16)

    Thank @kaggdesign for your reply.

    Actually, I’m getting the prefetch code, even with the above code in place. Should I add other code?

    Please correct me if I misunderstood your explanation.

    Thread Starter joe16

    (@joe16)

    Thank you @kaggdesign for your reply.

    Actually, the prefetch code is still present even with the above code in place. Is there other code to add?

    Please correct me if I misunderstood you.

    UPDATE: there was a display bug so I typed my response twice.

    • This reply was modified 3 months, 1 week ago by joe16.
    Plugin Contributor