Title: [Plugin: NextGEN Gallery] Skip load scripts
Last modified: August 19, 2016

---

# [Plugin: NextGEN Gallery] Skip load scripts

 *  Resolved [sta1r](https://wordpress.org/support/users/amucklow/)
 * (@amucklow)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/)
 * I notice the latest version of Next Gen Gallery (1.6.2) has an additional constant‘
   NGG_SKIP_LOAD_SCRIPTS’. However I’m not sure how to use it?
 * Here’s line 322-4 of nggallery.php:
 *     ```
       // if you don't want that NGG load the scripts, add this constant
               if ( defined('NGG_SKIP_LOAD_SCRIPTS') )
                   return;
       ```
   
 * Can I modify my theme to prevent additional scripts loading in wp_head()?
 * The alternative is to comment out lines 125-6, but this of course gets overwritten
   at upgrade:
 *     ```
       //add_action('template_redirect', array(&$this, 'load_scripts') );
       //add_action('template_redirect', array(&$this, 'load_styles') );
       ```
   
 * Would be good if this was an admin option.

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

 *  [Alex Rabe](https://wordpress.org/support/users/alexrabe/)
 * (@alexrabe)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690026)
 * You just need to define the constant , therefore I added this.
 *  Thread Starter [sta1r](https://wordpress.org/support/users/amucklow/)
 * (@amucklow)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690060)
 * Sure – I kind of tried this. Could you tell me how to do this properly?
 * I’m trying:
 *     ```
       define('NGG_SKIP_LOAD_SCRIPTS', NULL);
       ```
   
 * in my view file – but it’s not doing anything.
 *  [Alex Rabe](https://wordpress.org/support/users/alexrabe/)
 * (@alexrabe)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690133)
 * Not NULL, use TRUE 🙂 and move it to the wp-config.php file… The templates will
   be loaded later
 *  [Dan White](https://wordpress.org/support/users/danwhite85/)
 * (@danwhite85)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690229)
 * I’m still having issues with this. I define it in wp-config and nothing. My situation
   is that I am using the NextGen Galleryview addon. I already include jquery on
   my page and I don’t need half the other scripts that are being loaded. I especially,
   would like NextGen from loading Jquery a second time.
 * Any help would be greatly appreciated.
 *  Thread Starter [sta1r](https://wordpress.org/support/users/amucklow/)
 * (@amucklow)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690232)
 * [@dan](https://wordpress.org/support/users/dan/) White
 * You need to put the line at the bottom of your wp-config.php file, but not right
   at the bottom. Like so:
 *     ```
       /* Prevent load of NGG JS */
       define('NGG_SKIP_LOAD_SCRIPTS', TRUE);
   
       /* That's all, stop editing! Happy blogging. */
       ```
   
 *  [Dan White](https://wordpress.org/support/users/danwhite85/)
 * (@danwhite85)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690234)
 * One more thing. BTW, that worked! Thanks! However, after getting that to work
   I realized that jquery is actually being loaded the second time by nextgen galleyview
   inside the nggGalleryView.php file.
 * if I comment out:
    ` add_action('wp_print_scripts', array(&$this, 'load_scripts'));
 * Which calls:
 * `
    function load_scripts() { wp_enqueue_script('easing', $this->plugin_url . '
   jquery.easing.1.2.js', array('jquery'), '1.2'); wp_enqueue_script('galleryview',
   $this->plugin_url . 'jquery.galleryview-1.1.js', array('jquery'), '1.1'); wp_enqueue_script('
   timers', $this->plugin_url . 'jquery.timers-1.1.2.js', array('jquery'), '1.1.2');}
 * Then jquery is not called again and neither are any of the galleryview scripts.
   The problem is that I don’t see that load_scripts calls jquery anywhere. So where,
   how is it being included?
 * Thanks!
 *  Thread Starter [sta1r](https://wordpress.org/support/users/amucklow/)
 * (@amucklow)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690238)
 * As you say that plugin doesn’t load jquery – but it does use the `wp_enqueue_script()`
   function – which has a parameter for dependencies:
 * [http://codex.wordpress.org/Function_Reference/wp_enqueue_script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script)
 * I’m pretty sure the function instructs WordPress to load its own included copy
   of jQuery _before_ it executes e.g. galleryview, timers and easing scripts.
 *  [Dan White](https://wordpress.org/support/users/danwhite85/)
 * (@danwhite85)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690245)
 * OK! That worked. But now I have a new issue. The galleryview plugin itself causes
   errors in IE8. Because of IE’s problem with jQuery’s .css(). In addition, I have
   heavily modified the plugin to do exactly what I want it to. I would rather avoid
   this, because any update would overwrite my changes and break the site.
 * I have decided that I would like to disable NextGen’s scripts & css totally. 
   Manually include the Cycle plugin and create my own instance of it, where I have
   full control of the jquery variables and css.
 * However, I do not know how to go about this. I have searched for easy ways to
   query the data from NextGen Gallery, but no luck. Could you give me any recommendations?
 * Thanks a lot!
 *  [numaga](https://wordpress.org/support/users/numaga/)
 * (@numaga)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690291)
 * > [@dan](https://wordpress.org/support/users/dan/) White
   > You need to put the line at the bottom of your wp-config.php file, but not 
   > right at the bottom. Like so:
   > /* Prevent load of NGG JS */
   >  define(‘NGG_SKIP_LOAD_SCRIPTS’, TRUE);
   > /* That’s all, stop editing! Happy blogging. */
 * I did only this, and it took away 33 KB of scripts from my home-page and everything
   kept working. Thank you for that! I’m looking forward for more optimization for
   this gallery plugin. It’s the best plugin outthere but also one of the most heavy
   for my server, especially with high traffic.
 * Still waiting for the day thumbs and images will become sprite-able. When this
   plugin supports sprites, I’ll jump off a roof from happiness 😀
 *  [NTrost](https://wordpress.org/support/users/ntrost/)
 * (@ntrost)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690307)
 * As a quick fix for getting rid of NextGen GalleryViews added scripts, including
   the jquery that it pumps in. I was able to place this at the bottom of functions.
   php
 * `remove_action ('wp_head','nggGalleryViewHead');`
 * I put it into an if statement that keeps it out of all but my gallery page and
   admin pages. Of course I have a fairly small site, so some additional code might
   be preferable with larger sites.
 * Just figured I’d post this, as I spent a lot of time racking my brain trying 
   to figure out how to rewrite the GalleryView script to include it into a wp_enqueue_script
   so I could deregister it in functions.php.
 * Hope this helps someone.

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

The topic ‘[Plugin: NextGEN Gallery] Skip load scripts’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

 * 10 replies
 * 5 participants
 * Last reply from: [NTrost](https://wordpress.org/support/users/ntrost/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-skip-load-scripts/#post-1690307)
 * Status: resolved