NextGEN Gallery Optimizer

NextGEN Gallery Optimizer

NextGEN Gallery Optimizer is a self-developed WordPress plugin that prevents NextGEN's scripts & css from loading on posts without galleries.

I’ve been doing a lot of WordPress development as of late, and as a result of some speed optimization I was carrying out for a client, I developed some clever functions to optimize the ever-popular NextGEN Gallery plugin – ensuring that its heavy scripts and stylesheets don’t load unless they’re needed.

I thought this work might benefit the community as a whole…so I’ve further developed it into a plugin called NextGEN Gallery Optimizer, which is now available to download from the WordPress Plugin Directory.

NextGEN Gallery Optimizer Settings


Basically, the plugin uses a regular expression to detect NextGEN’s [nggallery id=x] shortcode, and if found, inserts your css as per your selections on the plugin’s settings page. If the shortcode isn’t found, no gallery-related scripts or styles will be served – unburdening your gallery-free posts from the extra overhead and making them load considerably faster.

On top of page load speed, I discovered many people were having trouble installing the AWESOME Fancybox lightbox and synching it with NextGEN, so I’ve included and integrated it into NextGEN Gallery Optimizer as an easy-install option.

I’ve tested NextGEN Gallery Optimizer on WordPress 3.1.2 right up to the latest version 3.3.1. The plugin itself requires at least NextGEN Gallery 1.6.2 and up.

Please note:

This is only the first version, so there are some known limitations…

NextGEN Gallery Optimizer ONLY looks for the [nggallery id=x] shortcode, and ONLY on Posts! This means it will not add scripts and styles on posts embedded with NGG’s single images or slideshows, or add anything on WordPress Pages…well, at least not yet!

Please do let me know if you’d like to see these, and/or other functionalities incorporated into the plugin!

Download NextGEN Gallery Optimizer at

Have your say:

Questions? Comments? Ideas even? Let me know below…

And…if you like the development so far, a good rating on would be very encouraging.


Also, if you’d like to support further development of this plugin, or the creation of other optimization plugins…please consider a donation! It would be much appreciated!


Copyright © 2008 - 2018 Mark's Technology News - All Rights Reserved
Proudly powered by WordPress.