WordPress 4.5 is here! Yay! So what does this mean? Well, first all the new standard speed and quality improvements are always nice. There are improvements for the native customizer and more inline shortcut tricks for the visual editor. As always, WordPress keeps developers in mind with a slew of fancy new hooks and functions.
But what it means is that you need to be careful when upgrading.
Many of the smaller updates to WordPress are security and bug related, and most of the time go off without a hitch, but this version is a little different than other updates I have seen.
One of the biggest changes behind the scenes is that the WordPress Core uses the newest version of jQuery (the JavaScript library that most everyone uses now). With this new release of jQuery comes an ever more strict error checking methodology.
Let me clarify.
Before with jQuery, if you were writing a custom script for your site, small or large, you were allowed a certain margin of syntax error. Basically, as an example of syntax, if you forgot to wrap something with quotes properly, the script might still be allowed to run. Older versions of jQuery were more forgiving.
The new version of jQuery will halt immediately if it encounters any small syntax errors. What myself and others are finding out now is that lots of jQuery code out there were doing-it-wrong all this time, and they never noticed because jQuery incorrectly worked just fine some particular styles of incorrect code.
How does this effect you and why should you be careful when updating?
Most every plugin and theme utilizes jQuery to some extent. If one line of jQuery code out of your entire collection of plugins and theme files is wrong, then it could cause critical functions on your site from working. It could break your site.
Here are some helpful tips to ensure your update to WordPress 4.5 is a happy update.
1. Backup files and database
Performing a backup should be done before any taking on an update. But make sure you have a filesystem and database backup pulled. Coordinate with your developer if you are not the person that is in charge of backing up the site. If you don’t currently use any backup software, I would recommend this free plugin: UpdraftPlus Backups. You can quickly create a full backup of files and database separately and download them easily.
2. Update Plugins and Themes First
So once everything is backed-up properly, then perform all your plugin updates. It is important also to update your theme. Most themes are heavy on the jQuery. We always use child themes in our installs so the parent theme can be updated. To read more about child themes click here.
–Now, go ahead and run the update to WordPress 4.5–
3. Thoroughly check your site, errors might not be evident.
I highly recommend using the Chrome browser, and use developer inspect tool to help. If you “right click” anywhere on your site, and then click on the “Inspect” option on the context menu it brings up the developer console. If there are any errors you might see something like this:
You can use this console to try and track down the file that is throwing the error. By expanding the “Uncaught Error:” line, it will show you a hierarchy of functions effected by this error. At the bottom of this list, you will find the culprit file. In this case, it is “main.min.js”
From here it depends on your development skills or contacts 🙂
If updating the themes and plugins didn’t help to avoid this, then either the plugin/theme developer has yet to push out an update, or there is an error in some custom javascript that either yourself or development team has written. You can try and fix the error manually or reach out to the original author.
At the end of the day, most WordPress updates are not quite as problematic. This happens to be one of those exceptions. If you stick to backing up and being careful when performing any updates in WordPress, you will save yourself any unpleasant downtimes, and in the end, you will have more happy updates.
To read more about the editing, customizing and under-the-hood improvements, please checkout the official announcement here.