I try my best to limit plugin usage and only use ones that are well designed. But I still find that many will load a lot of extra scripts and styles, and few have options to load selectively based on whether the plugin is being used.

I have started doing things like deregsitering the plugin scripts and them combining them one file and including it again myself, or using an if statement somewhere in the plugin file to only load it on certain page. But this can be a problem when the plugins are updated.

Is there a plugin that provides an easy interface to enqueue/dequeue all registered scripts and styles? If not, is there a better way to do it than what I've been doing?

  • This will be voted close because it's not an actual question, and not really possible to do well.
    – Wyck
    Sep 14, 2012 at 17:53
  • This is solved here. Got no close votes left right now.
    – kaiser
    Sep 14, 2012 at 18:08
  • I think this is a great topic, even if he didn't phrase the question perfectly. I've suggested an edit to improve it.
    – Ian Dunn
    Sep 15, 2012 at 4:48
  • @IanDunn Sorry, but this is answered already elsewhere and also a shopping question.
    – kaiser
    Sep 17, 2012 at 21:24
  • Huh, I thought it read more like a best-practice question. I don't think the answer would change much from site to site, so it's not really dependent on the OP's details, like a shopping question is. He didn't ask about any specific plugins, so it's geared towards a general technique rather than his specific site.
    – Ian Dunn
    Sep 17, 2012 at 22:07

2 Answers 2


I would suggest using a minify plugin that will automatically combine all the scripts and styles for you. Here are a few that will do it for you:


  • I think the question is asking about deregistering scripts completely, not minifying/concatenating them.
    – Ian Dunn
    Sep 17, 2012 at 22:08

Instead of modifying the plugins directly, you can create a functionality plugin and include all of the dequeue statements in there. That way you they won't be overridden when you upgrade the plugins.

The biggest thing to keep in mind is to make sure that you time things correctly. You have to make sure you call wp_dequeue_script() after the other plugin calls wp_enqueue_script().

For example, say a plugin loads a script like this:

function foo_enqueueScripts()
        plugins_url( '/js/useless-eye-candy.js', __FILE__ ),
        array( 'jquery', 'jqueryUI' ),

    wp_enqueue_script( 'foo_ueslessEyeCandy' );
add_action( 'wp_enqueue_scripts', 'foo_enqueueScripts' );

...then you can dequeue it like this:

function bar_removeExtraScripts()
    wp_dequeue_script( 'foo_uselessEyeCandy' );
add_action( 'wp_enqueue_scripts' 'bar_removeExtraScripts', 11 );

Notice that you're hooking into the same hook -- wp_enqueue_scripts -- that the plugin used, but with a higher priority -- 11 -- so that it will run after the plugin calls wp_enqueue_script().

  • You could also read all file contents and then append it to the first or last script...
    – kaiser
    Sep 17, 2012 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.