Question

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?

Thanks!

Was it helpful?

Solution

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.

OTHER TIPS

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

wp_deregister_script('jquery');

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top