Title: Conditional script/style loading
Last modified: August 22, 2016

---

# Conditional script/style loading

 *  [bsteinlo](https://wordpress.org/support/users/bsteinlo/)
 * (@bsteinlo)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/conditional-scriptstyle-loading/)
 * I was wondering if it was possible to only enqueue the wpgform JS and CSS on 
   the pages that contain the forms.
 * I know with Contact form 7 you can add a hook like add_filter( ‘wpcf7_load_js’,‘
   __return_false’ ); and then enqueue it when you want.
 * Does wpgform have a hook like this?
 * [https://wordpress.org/plugins/wpgform/](https://wordpress.org/plugins/wpgform/)

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

 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/conditional-scriptstyle-loading/#post-5707409)
 * There isn’t right now but this is something I will look into. I had ventured 
   down this path a while ago but can’t recall why I never implemented it. I agree
   that there is no need to load CSS or JS unless the rendered page has a form on
   it.
 *  Thread Starter [bsteinlo](https://wordpress.org/support/users/bsteinlo/)
 * (@bsteinlo)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/conditional-scriptstyle-loading/#post-5707410)
 * Awesome, thanks so much!
 *  Thread Starter [bsteinlo](https://wordpress.org/support/users/bsteinlo/)
 * (@bsteinlo)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/conditional-scriptstyle-loading/#post-5707482)
 * For anyone who is interested, I actually killed the 3 JS files being enqueued
   and it had no effect on my forms (for one that I’m using jquery-validate on I
   just enqueued it conditionally for that page) Here’s the function:
 *     ```
       function wpgform_dequeue_script() {
         wp_dequeue_script( 'jquery-columnizer' );
         wp_dequeue_script( 'wpgform-jquery-validate' );
         wp_dequeue_script( 'jquery-validate' );
       }
       add_action( 'wp_print_scripts', 'wpgform_dequeue_script', 100 );
       ```
   
 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/conditional-scriptstyle-loading/#post-5707504)
 * I have addressed this functionality to v0.73 of Google Forms. You can test it
   in the [beta version available on my web site](http://michaelwalsh.org/blog/2015/02/google-forms-v0-73-beta-1-now-available/).
 *  Thread Starter [bsteinlo](https://wordpress.org/support/users/bsteinlo/)
 * (@bsteinlo)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/conditional-scriptstyle-loading/#post-5707505)
 * Amazing, thanks Mike!

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

The topic ‘Conditional script/style loading’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wpgform_8cc59f.svg)
 * [Google Forms](https://wordpress.org/plugins/wpgform/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpgform/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpgform/)
 * [Active Topics](https://wordpress.org/support/plugin/wpgform/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpgform/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpgform/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [bsteinlo](https://wordpress.org/support/users/bsteinlo/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/conditional-scriptstyle-loading/#post-5707505)
 * Status: not resolved