How to migrate, upgrade, and fix jQuery in WordPress
Let me guess, you have a website that won’t perform ajax calls the add media button has stopped working, or woo commerce won’t go one action further on any front, right?
Nevertheless, hang around WordPress long enough, and the probability of themes, plugins, and/or core WordPress updates conflicting with one another will happen. Most theme and plugins don’t encounter technical challenges when updating unlike core WordPress updates. However, WordPress websites often perform extremely well as long as themes, plugins, and core updates are well maintained on a consistent basis.
Long before there were auto enabled updates across all three platforms, I made a decent living — still do to some extent — logging into clients environments and updating necessary themes, plugins, and core updates.
I’ve had my share of WordPress core updates that have halted any and all web activity, including the administrative dashboard — the latest experience was the WordPress 5.X update (nightmare). WordPress 5.5, jQuery Migrate 1.X was a planned stage removal in regards to updating WordPress’ overall jQuery version — virtually broke ever plugin and theme known to man, including the very popular Classic WordPress Editor and Yoast plugins.
The latest WordPress core was a nightmare because many of my customers are using outdated themes and plugins. In fact, one customer operates a WordPress website using a theme that only runs on PHP 5.6 — current version is PHP 7. We’ve tried to overall the theme, but to no avail, we’re having to scrap the old theme for a newly updated theme that and migrate with grace.
While jQuery has made our lives easier to a certain extent, there are moments when jQuery will conflict with itself or other libraries.
Case in point, the customer I briefly mentioned moments ago, recently encountered a slew of tech challenges that all pointed at jQuery conflicts. In addition to having an outdated theme not making use of 3rd-party CDN to include jQuery, this customer’s website also uses 42 plugins.
Yes, you read it right! 42 ACTIVE PLUGINS! Once a WordPress website gets beyond 15 or so plugins, this spells trouble. It’s only a matter of time before a plugin conflicts with another plugin, theme, or the WordPress core codebase.
In most cases, I recommend customers either deactivate all plugins and enabled one-by-one until the error is encountered, or simply deactivate plugins one-by-one until error disappears. I did neither one of these laborious tasks.
So, I know you’re wondering, what did you to remedy the jQuery conflicts in WordPress if you did neither of the aforementioned tactics? Well, wait for it… I opted for adding another plugin. 🤣 So, now we’re up to 43 PLUGINS, but all is well.
How to upgrade jQuery in WordPress
One of the easiest ways to upgrade and fix jQuery in WordPress is using the jQuery Updater plugin by Ramoonus. This plugin updates jQuery to the latest official stable version and includes the jQuery Migrate update. While it doesn’t replace or deleted existing jquery files, it does remedy a wide range of jQuery conflicts.
How to enable jQuery migrate helper
This next plugin is by far my most favorite and the one I turn to the most to ensure themes and plugins get their act together when attempting to not resolve their conflicts with one another.
Both jQuery Updater and Enable jQuery Migrate Helper plugins are my go to when themes and plugins stop working altogether. While I recommending installing one or the other, there is been only one case that I’ve used both on a WordPress website to bring it back into a fully working condition without errors.
How to load jQuery into WordPress using Google
Last but not least, another method to consider when migrating, upgrading, or fixing jQuery in WordPress is simply using a content delivery network (CDN), like Google or AWS, to include the most update version of jQuery.
This option is a bit different from the previous two because the jQuery file(s) are loaded directly from Google and not your web server — decreasing page load time drastically.
In closing, you’ll never have to concern yourself again about having the latest version of jQuery. Your website will be up to date and protected against security vulnerabilities due to outdated code in themes and plugins.
Let me know if you have any questions, comments, or encounter any additional technical challenges.