Last active
June 13, 2016 18:31
-
-
Save Herm71/916bc9481f62845ddc97248a871cab4a to your computer and use it in GitHub Desktop.
Replace WordPress jQuery with Google Hosted Libraries
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
/** | |
* Replace WordPress jQuery with Google Hosted Libraries | |
* @author Blackbird Consulting/Jason Chafin | |
* @link https://gist.github.com/Herm71/916bc9481f62845ddc97248a871cab4a | |
*/ | |
function bb_modify_jquery(){ | |
if (!is_admin()){ | |
// deregister WordPress JQuery | |
wp_deregister_script('jquery'); | |
//register and enqueue jquery | |
wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js', null, true); // register the external file | |
wp_enqueue_script('jquery'); // enqueue the external file | |
} | |
} | |
add_action('init','bb_modify_jquery'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment