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've read about the WP enqueue_script() function, but if I wanted to use a newer version of jQuery than what my WP installation is using, can I load it through this & WP will use the latest version? or will it load both? or what will happen?


share|improve this question
Let me advise you that this is a bad idea. When we release WP, we test the scripts that ship with it to make sure they work. When jQuery 1.5 came out a while ago, a lot of sites broke because people were loading the "latest" version of jQuery from the Google API. WP wasn't tested with that version yet, and it killed a lot of the admin screen as a result. Just be aware of what can happen when you start overriding the tested parts of WordPress with your own stuff. – EAMann Mar 17 '11 at 17:27
Thank you for the warning! – Brett Mar 17 '11 at 17:34
up vote 2 down vote accepted

To replace the default jQuery url, do:

wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'your custom url', ... );

Then call wp_enqueue_script( 'jquery' ); as usual.

Note that various pages in the WP admin might not be compatible with never versions of jQuery, not to mention plugin scripts.

share|improve this answer

You can (de)register the builtin jquery with the following functions:


And register a new jquery library:

wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js', array(), '1.4', true);
share|improve this answer
The stable is 1.5.1 already. :) Also for external script it is better to pass null for version - that will suppress version tag on output and improve caching aspects. – Rarst Mar 17 '11 at 22:39
The code example was a bit old ;). Thanks for the hint with the caching, I will look into this. – rofflox Mar 18 '11 at 9:31

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.