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

My Wordpress theme has a lot of .js scripts running and it takes plenty of time to load them all one by one. I would love to use a script loader like HeadJS or yepnopejs to speed things up.

But... what about wp_enqueue_script? I'm using it to load every single script (and I believe that's the BEST & ONLY way to go?).

Won't loading scripts using script loader instead of wp_enqueue_script create any conflicts with plugins, widgets etc.?

What about enqueuing the script loader itself?

share|improve this question
Is this your personal theme/site, or a public theme you're developing? – onetrickpony Sep 6 '11 at 0:03
Both, I guess! :) – Wordpressor Sep 6 '11 at 0:40
up vote 0 down vote accepted
  • If this is for your personal blog only, then just use a plugin that minifies and concatenates JS.

  • If it's for a theme you're building, then if the scripts are custom, or small & unlikely to be used by other plugins, merge them all into a single .js file, and load it in the footer.

    A more hardcore method would be to pick up registered scripts from the $wp_scripts global, unregister them all, and concatenate them into one file (or load them with headjs, whatever way you want to go). Here are some ideas if you go this way...

share|improve this answer

Building off of the code that @OneTrickPony provided, I came up with a solution for this that works pretty well for me. I posted it as an answer to another similar question here:


I hope it helps someone, and if you see any issues please leave me a comment on that other thread.

share|improve this answer

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.