Title: Prevent JavaScript enqueue on frontend
Last modified: October 7, 2017

---

# Prevent JavaScript enqueue on frontend

 *  Resolved [Micah Miller-Eshleman](https://wordpress.org/support/users/micahjm/)
 * (@micahjm)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/prevent-javascript-enqueue-on-frontend/)
 * Hi,
 * First of all, thanks for creating this super useful, well-designed plugin.
 * I’m in the process of implementing it at Goshen College (goshen.edu), a large,
   highly trafficked WordPress site, but am unable to do so b/c the plugin loads
   the recaptcha scripts _on every page_, even though we just need them on the login
   and password reset pages. Performance matters a lot to us, and we can’t afford
   to force 99% of our users to download scripts for the 1% who actually log in.
 * I’m planning on forking your plugin and commenting out line 18 of MchBasePublicPlugin.
   php:
 * `add_action('wp_enqueue_scripts', array( $this, 'enqueuePublicScriptsAndStyles'));`
 * It would be great if there was an action/filter/constant for disabling the public
   enqueueing of scripts & styles. Even better, you could only enqueue them publicly
   if one of the non-Wordpress options (WooCommerce, UltraCommunity, etc..) is checked.
 * Thanks!
 * – Micah
    -  This topic was modified 8 years, 7 months ago by [Micah Miller-Eshleman](https://wordpress.org/support/users/micahjm/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [MihChe](https://wordpress.org/support/users/mihche/)
 * (@mihche)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/prevent-javascript-enqueue-on-frontend/#post-9566293)
 * Hi Micah,
 * Is this good enough for you?
 *     ```
       add_action('wp_print_scripts', function (){
       	function_exists('login_header') ?: wp_dequeue_script( 'google-invisible-recaptcha' );
       });
       ```
   
 * ~Mihai
 *  Thread Starter [Micah Miller-Eshleman](https://wordpress.org/support/users/micahjm/)
 * (@micahjm)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/prevent-javascript-enqueue-on-frontend/#post-9567352)
 * Thanks Mihai, this would work for my use case.
 *  Plugin Author [MihChe](https://wordpress.org/support/users/mihche/)
 * (@mihche)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/prevent-javascript-enqueue-on-frontend/#post-9570167)
 * Hi [@micahjm](https://wordpress.org/support/users/micahjm/),
    Glad to hear that
   works for you. If you have a second to write a short review I’ll really appreciate
   that.
 * ~Mihai

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Prevent JavaScript enqueue on frontend’ is closed to new replies.

 * ![](https://ps.w.org/invisible-recaptcha/assets/icon-256x256.png?rev=1560060)
 * [Invisible reCaptcha for WordPress](https://wordpress.org/plugins/invisible-recaptcha/)
 * [Support Threads](https://wordpress.org/support/plugin/invisible-recaptcha/)
 * [Active Topics](https://wordpress.org/support/plugin/invisible-recaptcha/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/invisible-recaptcha/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/invisible-recaptcha/reviews/)

## Tags

 * [enqueue](https://wordpress.org/support/topic-tag/enqueue/)
 * [frontend](https://wordpress.org/support/topic-tag/frontend/)
 * [performance](https://wordpress.org/support/topic-tag/performance/)
 * [reCAPTCHA](https://wordpress.org/support/topic-tag/recaptcha/)

 * 3 replies
 * 2 participants
 * Last reply from: [MihChe](https://wordpress.org/support/users/mihche/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/prevent-javascript-enqueue-on-frontend/#post-9570167)
 * Status: resolved