How to control what jQuery version to include, with wp_enqueue_script

I’m using a script that is based on jQuery, so I’m not enqueue-ing jQuery directly, but via passing it in the array of dependent scripts:

 wp_enqueue_script("jquery-plugin-name",'', array('jquery'), '1');

This is loading jQuery v1.4.4, and it weighs 76kb, which seems very heavy, although the file looks compressed.

I have 2 questions:

  1. Is there I way in which I can make it load the latest version of jQuery?
  2. How can I make sure that the loaded file if minified?

Solutions Collecting From Web of "How to control what jQuery version to include, with wp_enqueue_script"

That’s the size of the minified jQuery nowadays 🙂

You can load the latest from Google:

wp_register_script('jquery', (""), false, '1.8.2');

Please keep in mind that this can cause issues moving forward, as you are forcing WordPress to load a certain version of WordPress instead of the version bundled with it. There are plugins out there that may be better suited for your needs, like WP JQuery Plus, which make sure to load the same version number as WordPress does, but with the benefit of loading it from Google.

Do not modify the version of jQuery enqueued by WordPress.

Just don’t do it. Core depends on a specific version. Themes and Plugins depend on a certain version. That certain version is the version bundled with a given version of WordPress.

If you need to perform script minification, compression, or concatenation, you can certainly do that (you can roll your own, or use a Plugin, such as W3 Total Cache, to do it for you.)

But as you can see: if you’re got a 46kB file, you’re already dealing with some combination of minification and compression.