• It looks like the plugin loads JS on every page and I am curious if this is necessary or you could update it to give the option to only run it on login pages?

    Google PageSpeed is throwing it on several sites as an ‘opportunity’ to ‘remove unused javascript’

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can add this code to functions.php to remove it from the home page or you add the condition to show it only on the login page

    function conditionally_load_plugins() {
        // Remove from Home page
    	if(is_front_page()) {	
    		wp_dequeue_script('google-invisible-recaptcha');
    	}
    }
    add_action( 'wp_enqueue_scripts', 'conditionally_load_plugins' ); 

    I’m not sure why the script isn’t enqueued based on the plugin’s settings.

    I want to add some code to conditionally dequeue it, but if I hard-code the condition, I’ll have to remember to change the code if the admin settings get changed.

    Ideally the condition would be based on the plugin’s admin settings – but why doesn’t the plugin itself do that?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘JS running on every page’ is closed to new replies.