How to perform safe update of WordPress themes and plugins
Plugins are an integral part of WordPress as they help you add new features and functionality in your WordPress site. But if you fail to update your WordPress plugins properly, it may lead to software conflicts or errors. Also, you may end up compromising the security of your WordPress site.
Keeping your WordPress plugins, themes or core upgraded is not a difficult task but there are some considerations that you must not overlook. This is because if you do not correctly upgrade them, it can disrupt the functionality of your site or even make you compromise the security of your WordPress website. At the same time, WordPress themes and plugins can significantly improve the functionality and appearance of your site, improve web traffic and eventually, the conversion rate and business revenue.
how often one must update WordPress core, themes and plugins?
The answer is: whenever there is an update! The more you are going to wait, the harder it becomes, so you must update it whenever there is a need and a new update is available. Most of the times, new updates build on old updates. Also, you may make changes to templates, and the way data is being stored inside the database, which can easily be controlled in increments.
Indeed, such updates are highly crucial for security purpose. So don’t just wait to perform a security update as this can be critical for your WordPress, putting it at a server risk. Whenever security vulnerability is identified, the information about the exploitable code gets published all over the internet. Eventually, any hacker can easily and instantly write bots and crawl the site automatically to exploit such vulnerabilities.
In extension to that, outdated plugins, themes, and WordPress versions are the easiest way to get your site’s access by hackers. Even deactivated plugins or themes can easily make your system quite vulnerable. Hence, to assist you with that, in this article, we will be discussing some recommended practices to keep your WordPress up-to-date.
But before we dig into these best practices, if you are wondering about the maintenance plans which are offered by many people, claiming to help the user in staying up-to-date, then you must know that such ideas come with a problem. These plans provide these updates only on a quarterly, monthly or weekly basis. Since updates must be done on time, this approach fails in meeting your update requirements and exposes your site to a security vulnerability. After all, these updates are better to be done ASAP instead of following a predetermined schedule.
So, as you read on, we will be discussing the following essential aspects:
Now let’s discuss each one of them separately!
1. Make sure to backup your site before updating anything
The one mistake that many users make and face the consequences of losing their site database is failing to make a proper backup before performing updates. Therefore, you must avoid the mistake and remember to keep a good and recent backup of your WordPress site. This will help you in restoring your data in case any upgrade or update goes wrong. For this, make sure you make both types of backups, i.e., DATABASE ONLY BACKUP as well as FULL SITE BACKUP, which is also known as a complete backup.
Download and store both backups as mentioned above in any of your local computers. To assist you further, here are some useful plugins you can use.
Note: Always maintain an adequate and reasonable size of your backup. Moreover, do exclude large files and upload in folders.
2. Test your site for any conflicts in a staging environment locally
Without interrupting your live site, there are a lot of ways in which you can build a staging environment to test your site updates.
Establish a staging site for WordPress by using the available localhost
Typically, you must maintain a locally hosted copy (perpetual) of your site. With that, you may run all the updates first using the local site and then push or perform the update to the site’s live server by using Git. This prevents the surprises that come after an update. Also, the variation regarding the server and your locally hosted site is MySQL and PHP versions.
However, if you like to match your live and local environment perfectly, you may either use Vagrants (virtual development environments) like other developers or any of the below mentioned options.
You may go with Desktop Server and quickly make a replica of your locally hosted site, check/test the updates and fix or make a note of issues, repeating the process on the live website.
For this, you will have to prepare your site’s Zip backup by the use of any of the above-listed backup plugins. Also, make sure to leave out large directories, as you must not test the update with regards to each uploaded media file. Now download the file (zip) and import it to Desktop Server and you have your site’s local version, which you may break anytime as per your discretion.
WP Staging Plugin
If you use WP Staging Plugin, you can easily create your site’s clone in the subdirectory of your hosting account (current). The plugin, however, is accessible on WordPress hosts (non-managed) such as Blue Host or HostGator with shared standard hosting.
To perform the task-
3. Accessing staging environment by using a managed WordPress host
For this, it is recommended that you go with hosts such as Get Flywheel, WP Engine, and Site-Ground as they offer reliable performance, backups, security, and one-click staging environments. When you look at all the provided features, using and making the most of this option makes more sense than incurring cost in manually setting up things.
WP Stagecoach and WordPress staging environment
Considerations in updating WordPress plugins
Here is some useful information that you must know before you go ahead with a plugin update.
Updating your WordPress core file
Some WordPress versions do conflict with an outdated plugin or theme. Just like in the case of plugins and themes, you should not hesitate to update patches as well such as 3.0 to 3.0.1 and for major updates 5.0 to 5.1, but make sure it is compatible with your existing themes and plugins.
Also, update testing using the site’s local copy is a good idea. However, some people might come across some issues in updating their site from 4.9.2 to 5.0 if the site runs with WPML - WordPress Multilingual Plugin. Moreover, you might also need to update your theme. So, make sure you keep everything adequately backed up.
To ensure the plugin is compatible with WordPress latest version, you may check the plugin on any of its forum or WordPress.org. In case the WordPress upgrade comprises the jQuery library update, it may conflict with the jQuery integrated with your theme or plugin and may lead to some issues with regards to jQuery. For instance, the Ajax content editor or the theme’s slider might stop working correctly and in this case, updating your theme becomes inevitable as well as mandatory with WordPress update.
Replacement of Abandoned Plugins
Before you update the plugin, first check the date of your plugin’s last update from wherever you purchased it or on WordPress.org. Determine the viability of your plugin if it has not been updated in the previous 6 months. If you think that the support is not offered anymore, search for a new plugin which can be maintained better. Similarly, if your plugin has not been updated for more than two years, start looking for an alternative. This is because if your site uses an outdated plugin, which has not been maintained for long, either your site will get hacked or it will break eventually.
Regular Update of WordPress Plugins
Whenever there is an update available, you must update your plugin at the earliest, especially plugins patches which are security fixes and bug. To make sure the functionality of your site as you update the plugin, hold off the plugin upgrades unless you go through the changelog on plugins’ website or WordPress.org. Sometimes such changes are way too significant and this would require you to rebuild stylesheets, customized template files or re-enter data. You can find this information and details as you read the changelog.
First Update the WordPress Plugin
If you are performing a significant upgrade to both WordPress and plugins, you must first update plugins and check them one by one. If you upgrade WordPress first, it will prompt you again to update your plugins so that it is compatible with the WordPress latest version. Also, if a plugin comes with a theme, you will also be required to update your theme to work with your new plugin properly.
Updating premium plugins
Here is what you need to do to update premium plugins:
Style updates/ Plugin template
In the case of theme up-gradation:
WordPress theme update
WordPress theme update can turn out to be a little tricky because the update will overwrite all the customizations you made for the theme files (but only If the changes are incorporated in a child theme). Similarly, the update will also overwrite your already set options.
Therefore, read on as we share some considerations that you must keep in mind.
Just like cars, WordPress greatest and latest themes too have a lot of whistles and bells. Also, it's time-consuming to update them.
The recent themes of WordPress hold a great many features and moving parts which are integrated together. They are highly exciting and robust and useful to perform almost every task, only if you keep them up-to-date and this takes time as the code changes from one version to another, radically.
Restoring plugin files and WordPress themes
Sometimes, the upgrade to a theme or plugin goes terribly wrong and in this case, you can easily replace those plugin and theme files using the backup you created above. However, in the case of a backup plugin, first, you would need to unzip your complete backup. After that, simply FTP the plugin or theme older version to the wp-content> plugins or themes folder, overwriting the plugin or theme’s new version with that backup.
WordPress.org and restoration of WordPress plugin older version
If you face an issue regarding a plugin on WordPress.org, try re-installing the plugin’s older version that can be easily upgraded without needing any of your backups.
Restoration of WordPress database
If you cannot use one-click restore or if you don’t use VaultPress for your site’ restoration, you will need to restore both of the files (using FTP) and your database manually. Such instructions are a little longer, and you must restore the database a lot more carefully. However, have a look at the below-discussed instructions and ensure that you don’t delete any other database inadvertently.
First, download your database’s backup which you built before the upgrade but if you prefer a backup plugin then unzip the backup of the database which you created. Look for the file ending as ‘.sql.’
- Log in to the control panel of your web hosting.
- Go to database wizard of MySQL.
- Create a new database, username/password by following the steps. Note down the database username, database name, and database password. Don’t forget to provide all privileges to the new user.
- In your web-hosting control panel, click on phpMyAdmin.
- For this, you may need the credentials (username and password) you created in earlier step.
- On the phpMyAdmin window left side, click on the database name.
- As you go in Structure tab, you will find ‘No tables found in database”.
- Now click on import tab on the screen’s top.
- Click on Browse button appearing next to the ‘file to use’ field on the next page.
- As you click on browse, locate the stored file – backup – on your computer.
- Ensure SQL is properly selected in the drop-down menu of Format.
- Click on Go button to import database tables.
- Use FTP or File Manager, a control panel of your web-host to log in to your website.
- Create a wp-config.php file copy.
- Edit the original file – wp-config.php to contain the username, database name, and password which you created earlier in step 3.
- You are now done restoring the old database.
Note: in the case of using BackupBuddy, you may need to use the importbuddy.php script for the restoration of the database and to overwrite the tables of the old database instead of building an entirely new one.
Your site breaks due to a theme upgrade or WordPress plugin – What to do?
If you have broken your live site, you need first to restore it using a backup. However, if you have incorporated a staging environment, follow the below-discussed tips to move forward and adequately troubleshoot your site.
1. Read the documentation, support forums and Changelog
If you read the changelog, support forum or documentation, you can learn from the experiences of other people. If any other person has also experienced the same issue, this indicates a better chance to know the fix or to discuss it right there.
2. Use correct shortcode and re-save options
If the plugin feature or a slider is not loading correctly as you upgrade, you should click on UPDATE or SAVE CHANGES so that the function or slider can re-connect to the layout or page. Make sure all other settings and images are same as before in the older version. At times, major updates make you re-choose all the options. And in some updates, you only need to click on a button and your choices will be saved and will start working again.
Some theme shortcodes or plugin may no longer be same or changed, so you must use the right shortcodes and read the documentation.
3. Clear your browser and site cache
While you may think the upgrade/update the underlying reason for your broken site, this sometimes also result from some cached files interfering with your site’s proper loading. These interfering cache files may bring in various kinds of unpredictable behaviors. So, your best bet is to log in to the dashboard of your WordPress and delete all the cached files in the caching plugin and after that, also remove your browser’s cached files. Now try viewing or logging in to your site using a different browser.
4. Troubleshooting-style concerns after WordPress plugin or theme upgradation
If you are wondering why the modifications in CSS style are not incorporated to your new plugin or theme, there may be some reasons for that. These include:
- HTML is changed – In case HTML Classes or IDs have changed, your old plugin or theme’s used CSS will be ignored. However, to fix it, use the Inspect Element Chrome feature, Firebug or Safari for the identification of proper CSS selector and to modify the same in the stylesheets of your child theme as required.
- Styles are overwritten - As you update the plugin or theme, maybe some of the methods or stylesheets included in these plugins or themes are overwritten. To fix this, just copy the stylesheets and styles at an appropriate location. This can be in FTP directory or plugin or theme options. You may also compare both the old and new site to determine the location.
Position for styles is changed – Just like updates to NextGEN Gallery and The Events Calendar, maybe your stylesheets
- location must have moved. For this, read the documentation of the plugin for information as to what should be the location of your new stylesheets in the FTP directory.
5. WordPress does not load or breaks after update
One way to narrow down the problem’s source is to eliminate variables (like removing all the themes and plugins) and turning on the feature of debugging. While you may not get over with the problem completely, you can at least narrow down the problem’s source.
It’s Time to Reward Yourself!
If you have successfully dealt with all the issues along with upgrading everything, you did a good job! It’s time to relax and enjoy the updated version of the site while you cater more web-traffic to your WordPress site!