最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

functions - Is it possible to load recaptcha script only in url with fragment identifier (#)?

programmeradmin3浏览0评论

I have tried various snippets, like this:

<?php   
add_action( 'wp_print_scripts', 'load_captcha_script', 100 );
   function load_captcha_script() {
    if ( !is_page( '#register' ) ) {
        wp_deregister_script('google-recaptcha');
    }
   }

but it doesn't work in #register section with hash, I also tried with if (window.location.hash == "#register")

But nothing, recaptcha doesn't load when floating form appears, Is there a snippet that only loads the script when the section appears?

发布评论

评论列表(0)

  1. 暂无评论