• Hello,
    Since I don’t need all the css and js enqueued by NextGen (I have my own), I use to dequeue all that to speed up things and load as few resources as possible.

    add_action('wp_enqueue_scripts', 'deregister_css', 999);
    function deregister_css() {
      wp_dequeue_style('nextgen_basic_thumbnails_style');
    }

    It used to work like a charm, but since version 3.9, it doesn’t work anymore, and I end up loading tons of css and js that I don’t want.

    I can see in your code the wp_enqueue_style call within the function enqueue_frontend_resources. The handle I’m using is still correct so why can’t I dequeue those?

    Commenting out the wp_enqueue_style is of course possible, but that’s not really a clean and serious option because any update would overwrite that.

    Any help would be appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Laurent OneChai

    (@lolobu)

    I figured out that setting define(‘NGG_SKIP_LOAD_SCRIPTS’, TRUE) fix my problem, no more dequeue 🙂

    Hi Laurent,
    I find your post very interesting. Using Query Monitor, I find NGG makes a lot of queries on loading. I am interested in reducing that number to improve performance, then I see your post. Can you share more details as how you go about doing this? I am not a developer but can follow instructions in confidence.

    Hi @francoc30,

    You can try Laurent’s suggestion by adding the mentioned by him line of code to your site’s wp-config.php file ( somewhere above the /* That’s all, stop editing! Happy publishing. */ line )

    Hope this helps

    Hi Mihai-imagely,
    As I said I am not a developer. I sure can add the mentioned code into wp-config.php.
    I am using NGG Plus. What will the impact on my slideshow and galleries displays? Will they still function as before? Will the loading of web pages faster? I don’t want to break my site though.
    Specifically, what does dequeuing scripts mean in terms of NGG? All NGG scripts are being skipped over during loading?

    • This reply was modified 4 years, 11 months ago by francoc30.
    Thread Starter Laurent OneChai

    (@lolobu)

    I did that only because I’m using my own CSS for NextGen galleries and my own Javascript for the lightbox. Therefore, I don’t want to load the one provided by the plugin.
    But if it’s not your case and you’re using NextGen the way it’s intented to be used, unloading the CSS and Javascript will break everything. They are meant to be loaded because they are requireds indeed.

    Ok Laurent, that makes sense. Thanks.

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

The topic ‘Cannot dequeue style anymore’ is closed to new replies.