Is the jQuery version running on your WordPress site up to date?
Your theme and plugins, as well as WordPress itself, rely on jQuery. An out of date version may place your website at risk.
In this article, we’ll show you how to update jQuery to the latest version in WordPress.
Why Upgrade jQuery to Latest Version in WordPress?
It’s important to keep jQuery up to date to maintain the security of your website. The latest version fixes bugs and vulnerabilities in previous versions that may place your site at risk.
If you are running the latest version of WordPress, then you don’t need to manually update jQuery. It’s automatically done for you. But if you’re using an older version of WordPress such as WordPress 5.4 or earlier, then it’s recommended that you do the update.
Also, if you’ve replaced the default WordPress jQuery with Google Library, then it wouldn’t automatically update to the latest version.
Editor’s Note: it’s important to highlight that updating jQuery may break older plugin functionality, so after the update, you should test your website. In most cases, it’s not an issue, but in case you run into problems, then you can easily return to the older version.
With that being said, let’s take a look at how to upgrade jQuery to the latest version in WordPress. Here’s what we’ll cover in this tutorial:
How to Determine if Your Version of jQuery Is Out of DateMethod 1: Upgrade jQuery to the Latest Stable VersionMethod 2: Control the Version of jQuery That Is Run on Your Website
How to Determine if Your Version of jQuery Is Out of Date
Next, you should paste the following command into the console:
This command will display the version of jQuery your website is running.
You should hopefully see version 3.5.1 or higher. If your website is running a version that starts with 1.7 or lower, then you should definitely upgrade.
Method 1: Upgrade jQuery to the Latest Stable Version
The jQuery Updater plugin updates jQuery to the latest official stable version. This is likely to be more current than the version that comes with WordPress.
First, you need to install and activate the jQuery Updater plugin. For more details, see our step by step guide on how to install a WordPress plugin.
Upon activation, your website will start running the latest version of jQuery. However, before you see the change, you may need to clear your browser cache and WordPress cache.
The plugin includes the jQuery Migrate script to help with backward compatibility. However, if you find that you have trouble with some of your plugins, then you can simply deactivate the jQuery Updater plugin to return your site to its original state.
Method 2: Control the Version of jQuery That Is Run on Your Website
The Version Control for jQuery plugin allows you to control the version of jQuery that is run on your website. This allows WordPress users to run a stable WordPress website, and WordPress developers can check if their code works with various versions of jQuery.
To get started, you need to install and activate the jQuery Updater plugin. If you need help, then see our step by step guide on how to install a WordPress plugin.
Upon activation, the plugin will default to the latest pre-release version of jQuery. It also installs the jQuery Migrate script to help with backward compatibility.
If you need to, you can select a different version of jQuery by visiting the Settings » jQuery Version Control page.
From here, you can select the jQuery and jQuery Migrate versions you wish to run on your site. Make sure you click the ‘Save Changes’ button to store your settings.
If the updated version of jQuery breaks some of your older plugins, then you can simply select an earlier version from the drop down menu. Alternatively, if you deactivate the Version Control for jQuery plugin, then your site will return to its original state.
We hope this tutorial helped you learn how to update jQuery to the latest version in WordPress. You may also want to learn how to increase your blog traffic, or check out our list of the most common WordPress errors and how to fix them.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
The post How to Upgrade jQuery to Latest Version in WordPress first appeared on WPBeginner.