Create a gist now

Instantly share code, notes, and snippets.

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