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:
- Backing up WordPress before updating
- Building a staging environment for updates-testing
- Tips for updating plugins
- Tips for updating themes
- Updating WordPress core
- Restoration of WordPress plugin or theme files
- Consequences if an update disrupts your site’s functionality
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.
- BackWPUp – It is a free plugin which offers various options for sending and scheduling to remote locations
- Duplicator – You may use the pro-version in order to schedule backups. This works great for migrations and the free version quickly duplicates the site.
- BackupBuddy – This one is a paid plugin but works great for migrations and scheduling.
- UpDraftPlus – This plugin is similar to BackupBuddy and BackWPUp but it’s becoming more popular now. The plugins offer both paid and free options for remote backup storage.
- WorpDrive – If you have multiple sites then WorpDrive is a very cost-effective option to go with. All you need is let the plugin run automatically once you enter FTP credentials. Moreover, you may test the backup to ensure its functionality in its interface along with using the feature of one-click restore.
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.
-
Desktop Server
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-
- Install this plugin and choose the items to be cloned.
- Login your cloned site, once it is installed in your current site’s sub-directory.
- Update plugins or customize themes but test everything.
- Check if it’s running as per the expectations. If yes, you can migrate the modifications to the production site.
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
- Establish your live site’s staging copy with just one click.
- Copy all the staging site changes back to WordPress live site.
- You may select the changes you wish to import, i.e., either import all or some of the file changes or/and your database changes.
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:
- For premium plugins, don’t forget to enter the license key.
- If a plugin comes bundled with the theme, go ahead and purchase the premium plugin. Theme developers generally take time in updating bundled plugins.
Style updates/ Plugin template
In the case of theme up-gradation:
- Update templates for your plugin – the one which uses customizable templates – and compares it with templates of the child theme. Examples of plugins using customizable templates include NextGEN Gallery, WooCommerce, and The Events Calendar.
- Maybe the plugin has got deleted, moved, or renamed, templates or the stylesheets, which you mirrored as your child theme.
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.
- In the case of modifying core theme files or to put in simple words, if you did not consider a child theme, then you will have to make the changes you made previously to theme files, to the new theme and this might take some time.
- If you used a child theme then updating a parent theme is easy and you must not worry about that. But make sure to compare the modified template files with those of parent theme’s new template files to know if the modified templates are compatible HTML. For this, you might need to rebuild the custom template files.
- Maybe the new theme will have new Classes and HTML IDs, so your changes regarding stylesheets will not be applied. For this, read on as we discuss the ways to handle the situation in which any theme or plugin update might break your website.
- Just like plugins, if the update is a theme patch and you have incorporated a child theme, then it will be easy to update. Set aside a day for an upgrade if the theme involves significant changes. However, the time required for this will depend on how old the parent theme is, how major your update is, and the number of customizations made to the child theme or the original theme.
- New plugins might not run smoothly with old themes, as you plan to incorporate these plugins with the latest WordPress version. That is why you would need to update themes even if it is not convenient.
However, with themes with static CSS/HTML, not using JavaScript, you don’t need to worry about theme update because such themes hardly have anything which would require an upgrade except for some deprecated WordPress functions. But again, if you use that old theme, your site must be boring and you must consider an update to keep it more interesting.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.
- Search your plugin using WordPress.org
- Click on Developers tab.
- Using another version list, download the plugin older version.
- First, deactivate and then delete the plugin’s newer version using the plugin list on the dashboard of your WordPress.
- Upload and activate the older version by clicking on Add New Plugin. Only if you have not made changes to the database, then this must adequately work, restoring your WordPress site as it was before upgrading the plugin.
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
Follow these steps to identify JQuery/JavaScript or PHP errors conflicts between theme plugins, themes, and other plugins. The purpose of the following steps is to isolate the problem and do away with as many variables as possible. However, you must always do it in a staging environment so that the live site is not broken during the process.
- Login to your WordPress using File Manager of web host or via FTP.
- Change the name of the plugins folder as plugins-old.
- Take the active theme from the theme folder and loose in the folder – wp-content.
- Activate the Twenty Seventeen default themes by login to the Dashboard of your WordPress.
- Go to the plugin page and check if all the plugins are now de-activated.
- Test your WordPress site, and don’t pay attention to messed up appearance since you are no longer using a theme.
- Now go to the File Manager or FTP again and change the folder – Plugin-old to plugins, moving the theme again to themes folder.
- First, edit the file – wp-config.php in public_html along with the line ‘define(‘WP_DEBUG,’ false)’ to ‘define(WP’_DEBUG’, true).
- Now activate the original theme.
- Test your site and note down the errors.
- In the case, theme is relying on an installed plugin, make sure such plugins are properly updated and activated.
- Test site again and note down the errors.
- If any error is found, read the plugin or theme’s support forum to get more information with regards to resolving the issue. Errors which are reported at the time debugging is turned on are not that critical, though developers should also pay attention to these. But unfortunately, the majority of the developers of premium themes is apathetic and hardly maintains the plugins or themes.
- In case of finding no error in required plugins or your theme, activate plugins one by one and note down the errors. Also, read the support forums to read more about known issues.o) Lastly, edit the file wp-config.php into public_html along with line ‘define(‘WP_DEBUG’, true) to ‘define(‘WP_DEBUG’, false).
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!