Friday, October 18, 2013

Replacing the default jQuery library in Wordpress the easy way

I you ever need a fresh jQuery version in your Wordpress theme, just copy this code in the functions.php file:

 //Replacing the default jQuery library  
 wp_deregister_script('jquery');  
 wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"), false, '1.10.2');  
 wp_enqueue_script('jquery');  

You can check the available versions here: https://developers.google.com/speed/libraries/devguide#jquery

Keep in mind that from version 2.0.0 support for IE6-7-8 is dropped!