My jQuery version with Sage 8.5.1

With Sage 8.5.1, I’m trying to use the same jQuery version that comes after installing Sage’s dependencies. First, it should reference Google’s CDN, then it should use the bower version as a fallback. However, WP is still incorporating its own jQuery version into the front facing site, and the CDN version is not present.

By default, this is included in the manifest.json file:

"jquery.js": {
      "bower": ["jquery"]
    }
  }

There are outdated references in the forums, I’m not sure how to implement.

To start with, You need to get into the init hook and remove the existing jquery that wordpress loads automatically, so that you can include your own.

add_action('init', 'modify_jquery');
function modify_jquery () {
    wp_deregister_script('jquery');
    // ... now load your own

}

This Gist shows a method to test whether the CDN is working and if not, load a local fallback.

This reply posted because it may be of some help to someone else, if not you, considering its been 5 months since you posted it and probably already solved this.

You could use soil.

1 Like