plugins - Stop wordpress from requesting external jquery from googleapi

Instead of using external jquery hosted on google i would like to use a local copy. I am able to tell wp to use the loca

Instead of using external jquery hosted on google i would like to use a local copy. I am able to tell wp to use the local version, however, I seem to be unable to stop wp requesting the google hosted one. when I do (in functions.php):

`function register_local_juery() {
    wp_deregister_script('jquery');
    wp_enqueue_script('jquery', 'url/to/local/jquery', array(), null, true);
}
add_action('wp_enqueue_scripts', 'register_local_juery');`

The result of this is that wp includes both. The local and external. How can I stop wp from using the external source? In times of increasing awareness with privacy, shouldn't that be a kind of more obvious option? Is it possible that the call to googleapi is initiated by any plugin I have installed? Or do they always use the one registered with wp theme?

Instead of using external jquery hosted on google i would like to use a local copy. I am able to tell wp to use the local version, however, I seem to be unable to stop wp requesting the google hosted one. when I do (in functions.php):

`function register_local_juery() {
    wp_deregister_script('jquery');
    wp_enqueue_script('jquery', 'url/to/local/jquery', array(), null, true);
}
add_action('wp_enqueue_scripts', 'register_local_juery');`

The result of this is that wp includes both. The local and external. How can I stop wp from using the external source? In times of increasing awareness with privacy, shouldn't that be a kind of more obvious option? Is it possible that the call to googleapi is initiated by any plugin I have installed? Or do they always use the one registered with wp theme?

Share Improve this question edited Oct 3, 2019 at 7:22 Macs asked Oct 3, 2019 at 7:17 MacsMacs 32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

WordPress doesn't use externally hosted jQuery. In fact, as far as I'm aware, WordPress core does not register any externally hosted scripts.

WordPress bundles its own version of jQuery, and you can enqueue the bundled version by just enqueueing the handle jquery:

wp_enqueue_script( 'jquery' );

Or by specifying 'jquery' as a dependency:

wp_enqueue_script( 'my-script', '/path/to/my-script.js', [ 'jquery' ] );

If you enqueue jQuery like that, but it's still loading an externally hosted version, then your theme or a plugin is either loading its own version separately, or has re-registered jquery with an external version. The easiest way to find the culprit is to deactivate plugins, checking your site after each one, to see if the correct version is loading.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745110299a4611807.html

相关推荐

  • plugins - Stop wordpress from requesting external jquery from googleapi

    Instead of using external jquery hosted on google i would like to use a local copy. I am able to tell wp to use the loca

    10小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信