Skip to content

Instantly share code, notes, and snippets.

@lukecav
Created November 4, 2016 18:42
Show Gist options
  • Save lukecav/6978e8f213cc1f51c9a1a0c19a338707 to your computer and use it in GitHub Desktop.
Save lukecav/6978e8f213cc1f51c9a1a0c19a338707 to your computer and use it in GitHub Desktop.
Replace the default WordPress jQuery with Google Library hosted version
add_action( ‘wp_enqueue_scripts’, ‘register_jquery’ );
function register_jquery() {
if (!is_admin()) {
wp_deregister_script(‘jquery-core’);
wp_register_script(‘jquery-core’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js’, true, ‘1.11.3’);
wp_enqueue_script(‘jquery-core’);
wp_deregister_script(‘jquery-migrate’);
wp_register_script(‘jquery-migrate’, ‘http://cdn.yourdomain.com/wp-includes/js/jquery/jquery-migrate.min.js’, true, ‘1.2.1’);
wp_enqueue_script(‘jquery-migrate’);
}
}
@otvoslaszlogabriel
Copy link

Thanks this did the trick for me !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment