WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
This will be voted close because it's not an actual question, and not really possible to do well. – Wyck Sep 14 '12 at 17:53
This is solved here. Got no close votes left right now. – kaiser Sep 14 '12 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 '12 at 4:48
@IanDunn Sorry, but this is answered already elsewhere and also a shopping question. – kaiser Sep 17 '12 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 '12 at 22:07

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:


share|improve this answer
I think the question is asking about deregistering scripts completely, not minifying/concatenating them. – Ian Dunn Sep 17 '12 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().

share|improve this answer
You could also read all file contents and then append it to the first or last script... – kaiser Sep 17 '12 at 21:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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