Created
November 4, 2016 18:42
-
-
Save lukecav/6978e8f213cc1f51c9a1a0c19a338707 to your computer and use it in GitHub Desktop.
Replace the default WordPress jQuery with Google Library hosted version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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’); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks this did the trick for me !