我一直在使用下面的代码来使用Google的jQuery,但最新的WordPress版本停用了它。如何使用Google的jQuery?
//* Use Google\'s jQuery
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 = \'3.4.0\';
}
wp_deregister_script(\'jquery\');
wp_register_script(\'jquery\', "//ajax.googleapis.com/ajax/libs/jquery/$ver/jquery.min.js", false, $ver);
}