Skip to content

Instantly share code, notes, and snippets.

@rkjha
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkjha/10091723 to your computer and use it in GitHub Desktop.
Save rkjha/10091723 to your computer and use it in GitHub Desktop.
Add this to theme's `function.php`, in order to load jQuery from google cdn and jquery migrate from jQuery cdn (don't forget to update the plugin version)
/* loads minified jQuery (1.10.2) from Google CDN and jQuery migrate from jQuery CDN */
function jquery_cdn() {
if (!is_admin()) {
wp_deregister_script('jquery');
wp_deregister_script('jquery-migrate');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', false, '1.10.2');
wp_register_script('jquery-migrate', 'http://code.jquery.com/jquery-migrate-1.2.1.min.js', false, '1.2.1');
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-migrate');
}
}
add_action('init', 'jquery_cdn');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment