Support » Plugins and Hacks » NextGEN Gallery » How to stop loading js and css (deregister script)

How to stop loading js and css (deregister script)

  • Hi, I’ve updated to NextGen 2, everything works fine, but I don’t want to load any of the js and css of the plugin in my blog.
    With older version I used the lines

    wp_deregister_script( 'nng_script' );
    wp_deregister_script( 'ngg-slideshow' );

    in my function.php theme file. Now what shall I do?


Viewing 14 replies - 1 through 14 (of 14 total)
  • EDIT:
    what I should remove is ALL this stuff I found in my page:

    <script type='text/javascript'>
    /* <![CDATA[ */
    var photocrati_ajax = {"url":"http:\/\/www..it\/photocrati_ajax","wp_site_url":"http:\/\/www..it","wp_site_static_url":"http:\/\/www..it"};
    /* ]]> */
    <script type='text/javascript' src='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ajax/static/ajax.js?ver=3.5.2'></script>
    <script type='text/javascript' src='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/resource_minifier/static/sidjs-0.1.js?ver=0.1'></script>
    <script type='text/javascript' src='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/resource_minifier/static/lazy_resources.js?ver=3.5.2'></script>

    <!-- <meta name="NextGEN" version="2.0.0" /> -->

    link rel='stylesheet' id='nextgen_basic_thumbnails_style-css'  href='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/nextgen_basic_thumbnails.css?ver=3.5.2' type='text/css' media='all' />
    <link rel='stylesheet' id='nextgen_pagination_style-css'  href='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_pagination/static/style.css?ver=3.5.2' type='text/css' media='all' />
    <link rel='stylesheet' id='nggallery-css'  href='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/css/nggallery.css?ver=3.5.2' type='text/css' media='all' />
    <link rel='stylesheet' id='lightbox-0-css'  href='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/jquery.lightbox/jquery.lightbox-0.5.css?ver=3.5.2' type='text/css' media='all' />
    <script type='text/javascript'>
    /* <![CDATA[ */
    var galleries = {};
    galleries.gallery_24aebd8ff95206cdf26f01d12d0de7d0 = {"id":null,"source":"galleries","container_ids":["36"],"album_ids":[],"tag_ids":[],"display_type":"photocrati-nextgen_basic_thumbnails","exclusions":[],"order_by":"sortorder","order_direction":"ASC","image_ids":[],"entity_ids":[],"tagcloud":false,"inner_content":"","returns":"included","slug":null,"display_settings":{"override_thumbnail_settings":"0","thumbnail_width":"100","thumbnail_height":"75","thumbnail_quality":"100","thumbnail_crop":"1","thumbnail_watermark":"0","images_per_page":"0","number_of_columns":"0","ajax_pagination":"0","show_all_in_lightbox":"0","show_piclens_link":"0","piclens_link_text":"[Show PicLens]","show_slideshow_link":"0","slideshow_link_text":"[Show as slideshow]","template":"","use_lightbox_effect":true,"disable_pagination":0,"ngg_triggers_display":"never"},"sortorder":[],"maximum_entity_count":500,"_errors":[],"ID":"24aebd8ff95206cdf26f01d12d0de7d0","transient_id":"63b59239f1e79714771cc9e97e8745d0"};
    var nextgen_lightbox_settings = {"static_path":"\/static"};
    /* ]]> */
    <script type='text/javascript' src='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/static/common.js?ver=3.5.2'></script>
    <script type='text/javascript' src='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/nextgen_basic_thumbnails.js?ver=3.5.2'></script>
    <script type='text/javascript'>
    /* <![CDATA[ */
    nextgen_lightbox_loading_img_url = "http:\/\/www..it\/wp-content\/plugins\/nextgen-gallery\/products\/photocrati_nextgen\/modules\/lightbox\/static\/jquery.lightbox\/lightbox-ico-loading.gif";
    nextgen_lightbox_close_btn_url = "http:\/\/www..it\/wp-content\/plugins\/nextgen-gallery\/products\/photocrati_nextgen\/modules\/lightbox\/static\/jquery.lightbox\/lightbox-btn-close.gif";
    nextgen_lightbox_btn_prev_url = "http:\/\/www..it\/wp-content\/plugins\/nextgen-gallery\/products\/photocrati_nextgen\/modules\/lightbox\/static\/jquery.lightbox\/lightbox-btn-prev.gif";
    nextgen_lightbox_btn_next_url = "http:\/\/www..it\/wp-content\/plugins\/nextgen-gallery\/products\/photocrati_nextgen\/modules\/lightbox\/static\/jquery.lightbox\/lightbox-btn-next.gif";
    nextgen_lightbox_blank_img_url = "http:\/\/www..it\/wp-content\/plugins\/nextgen-gallery\/products\/photocrati_nextgen\/modules\/lightbox\/static\/jquery.lightbox\/lightbox-blank.gif";
    /* ]]> */
    <script type='text/javascript' src='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/jquery.lightbox/jquery.lightbox-0.5.min.js?ver=3.5.2'></script>
    <script type='text/javascript' src='http://www..it/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/jquery.lightbox/nextgen_lightbox_init.js?ver=3.5.2'></script>
    <script type="text/javascript">jQuery(function(){Lazy_Resources.load()});</script>

    It’s really A LOT of things: I have already a fancybox plugin, so I don’t need the one in NextGen, I already have a lazyload script, so I don’t want the one in NextGen, I already styled the gallery, so I don’t need the css of NextGen…. Please, help me to remove everything but the images! I love NextGen and how it keeps and sorts my album, but I don’t need everything else!

    I too would love to know how to accomplish this given that none of the solutions I have seen appear to work with NextGen 2.

    Like you, I already have my own CSS and jQuery plugins for handling the image galleries. All I need from NextGen 2 is the image management and templating capabilities.

    I haven’t searched for a solution, it was faster for me to turn back to NextGen 1 and keep it safe!

    I have the same issue. The plugin is actually great but I really don’t understand why the developers, after such a long time, are still not providing an easy solution for this task. It is actually so basic. Everybody who cares about really clean source code and the reduction of unnecessary overload, will be interested in an easy approach to clean up the ngg ‘code ballast’.

    Why not simply implementing a function for this into the settings of the plugin itself?

    Yes, definitely, to have options to decide which feature to use or not is the best approach with every huge plugin like this

    I agree 100%. I usually deregister all the useless js that I do not use and older versions of Nextgen this could easily be done but now cannot. Page load time on nearly every one of my sites has gone way up in Google Page Speed and this is even with using a cache plugin (W3TC).

    Think I am going back to Nextgen 1.9.3

    I did go back to Ngg 1.93 too and feel pain-free since it works just fine.

    I have sent an email with an address to the issue and this conversation to the developers. I am curious about the response. 🙂

    This was the main issue why I turned back from NGG2. I was hoping there would already be a solution, but obviously not. Still keeping my sites on 1.9.13.

    first step is to get through ‘gallery settings’ and ‘other options’ and disable every kind of lightbox fancy shutter whatever effect. Set related options to NO.
    This will drop most of the js and css files.
    I currently only have static/ajax.js added and I hope I find a way to drop that too.

    for css files:
    add this to your functions.php:

    // remove nextgen gallery css
    function nextgengallery_removeStyle() {
    add_action('wp_print_styles', 'nextgengallery_removeStyle');
    add_filter('show_nextgen_version', '__return_null');

    a good guess for the wp_dequeue_style function is the actual filename of enqueued nextgen css files.

    All the define(‘NGG_SKIP_LOAD_SCRIPTS’, true); snippets and other stuff around the boards does not work with the new version. Really a pity that this popular plugin does not offer a general checkbox to enable\disable all js and css files.

    Really a pity that this popular plugin does not offer a general checkbox to enable\disable all js and css files.

    I agree, it is hands down the best WP gallery plugin but not being able to turn off the js and css is a real let down. Hopefully the developer is planning to incorporate this option soon.



    I am still having completely irrelevant stylesheets on my header. They go as follows:

    <link rel='stylesheet' id='nextgen_basic_thumbnails_style-css'  href='http://localhost/sarkakrapova-new/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/nextgen_basic_thumbnails.css?ver=3.6.1' type='text/css' media='all' />
    <link rel='stylesheet' id='nextgen_pagination_style-css'  href='http://localhost/sarkakrapova-new/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_pagination/static/style.css?ver=3.6.1' type='text/css' media='all' />
    <link rel='stylesheet' id='nggallery-css'  href='http://localhost/sarkakrapova-new/wp-content/ngg_styles/nggallery.css?ver=3.6.1' type='text/css' media='all' />

    There are also those mysterious pieces of Javascript code:

    <script type='text/javascript'>
    /* <![CDATA[ */
    var photocrati_ajax = {"url":"http:\/\/localhost\/sarkakrapova-new\/photocrati_ajax","wp_site_url":"http:\/\/localhost\/sarkakrapova-new","wp_site_static_url":"http:\/\/localhost\/sarkakrapova-new"};
    /* ]]> */
    <script type='text/javascript' src='http://localhost/sarkakrapova-new/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ajax/static/ajax.js?ver=3.6.1'></script>
    <script type='text/javascript' src='http://localhost/sarkakrapova-new/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/static/frame_event_publisher.js?ver=3.6.1'></script>

    Does anyone know purpose of those strangers? I’m using NextGen gallery mainly for its back-end functionality, so my front-end is really basic. Is it SAFE to remove them and if so, what are their IDs to dequeue the suckers? 🙂

    Thank you!

    Here are the handle names for the javascript parts you posted above:

    Rob Aid


    Hey gerald, did you find all the scripts that need to be dequeued in order to fully clear the header from their CSS/JS?

    Sorry for being lazy to go though their code myself, too many obligations these days.

    except the ones I poste above I only dequeue this ‘nextgen_gallery_related_images’.
    I don`t have a single js\css added by nextgen anymore. If you still got one left, carefully go through the options and disable all kind of lightbox etc.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘How to stop loading js and css (deregister script)’ is closed to new replies.
Skip to toolbar