Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
add_action('init', 'use_jquery_from_google');
function use_jquery_from_google () {
if (is_admin()) {
return;
}
global $wp_scripts;
if (isset($wp_scripts->registered['jquery']->ver)) {
$ver = $wp_scripts->registered['jquery']->ver;
} else {
$ver = '1.12.4';
}
wp_deregister_script('jquery');
wp_register_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/$ver/jquery.min.js", false, $ver);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.