WordPress jQuery Compatibility Fixes

With WordPress 5.6 and 5.7 jQuery has been upgraded and support for jQuery migrate dropped. Finally! Say goodbye to jQuery v1.12.4 and hello to jQuery v3.5.1. Similar to WordPress 5.5, these jQuery improvements may cause incompatibilities issues with outdated themes or plugins. While applying compatibility fixes for Anchor Hosting customers, here are a few of the common issues along with recommended compatibility fixes in order to maintain a healthy WordPress site with WordPress 5.7 and beyond.

Upgrade all themes and plugins to latest versions.

This nearly goes without saying however the best thing you can do before upgrading to WordPress 5.7 is to upgrade all themes and plugins to their latest versions. For themes and plugins that are under active development, this will take care of most issues.

Manually upgrade outdated versions of bootstrap when needed.

The most common issue I came across was due to bundled outdated versions of bootstrap within themes and plugins. Within Chrome DevTools the Javascript errors were similar to this.

Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3
     at https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js:6:216
     at https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js:6:318

The solution is to upgrade outdated bootstrap with the latest major version directly within the themes or plugins. It’s best to stick within major versions. For example your theme is using Bootstrap v3.3.6 then I’d recommend upgraded to Bootstrap v3.4.1 not v4.5.3 as that can cause other things to break. These outdated Bootstrap reference can be located over SSH using the following command line search.

grep -rn "bootstrap" wp-content/

That may show many unrelated search results however it should be sufficient enough to identify all outdated references.

Searching for Bootstrap using grep

When possible, report issues to theme and plugin authors.

Most of these incompatibility issues are due to code which hasn’t been touched in more then 5 years. If you can report the issues to the theme and plugin authors. That only works if the product is still being supported. Due to the product age you’ll likely need to decide between one of these options:

  • Have a web developer manually fix the legacy theme or plugin
  • Replace the legacy theme or plugin with an alternative
  • Live with the incompatible and rollback jQuery

Rollback jQuery with jQuery Manager plugin.

If you update to WordPress 5.6 and are having issues you can’t resolve then you can temporarily installed the Enable jQuery Migrate Helper plugin. However with 5.7 that plugin with no longer work. Instead I’d recommend manually selected a version of jQuery and jQuery migrate using the jQuery Manager plugin. That will allow you to downgrade jQuery while keeping the latest version of WordPress core installed. This isn’t ideal however it can keep your website running. Just be sure to pick a well supported theme and selections of plugins when you eventually redo your website.