Upgrading your website’s theme to the latest version is highly recommended, not only because it ensures you have all the latest features, but you’ll also be up-to-date with any security patches.
There are many ways to upgrade a WordPress theme. In this post we’ll look at a few different methods, from automatically upgrading to ensuring a customized theme isn’t unintentionally over-written.
Back Up Your Theme Files
First thing’s first – before we get started you need to back up your database and your current theme. Since we’re replacing and updating theme files, there’s a chance something could go wrong so it’s best to play it safe and have a backup.
Use whatever method you feel most comfortable with. You may want to simply copy your entire WordPress directory to your computer using FTP and backup your database with a plugin. You may have a VaultPress account or a membership with some other third-party backup site that does all the hard work for you.
Automatically upgrading your theme is easy and straightforward. There are a couple of ways to take advantage of automatic upgrades:
- In your WordPress dashboard, go to Appearance > Themes. Any themes that have updates available will display an alert banner. Click on the theme you want to upgrade and click on “update now.”
- In your WordPress dashboard, go to Dashboard > Updates. The themes that have updates available will be listed. Select the theme you want to update and click “Update Themes.” This is also a quick way to update multiple themes.
WordPress 3.7 introduced automatic background updates for themes and plugins, which is disabled by default. To turn this feature on for themes, add the following snippet to your theme’s functions.php file:
add_filter( 'auto_update_theme', '__return_true' );
This feature will only work for themes downloaded from the WordPress Theme Repository. It you are using a premium theme, it will not automatically update. Premium theme providers usually offer their own instructions for upgrading themes.
Uploading and Replacing an Existing Theme
Most theme providers require that you manually upload a new version of a theme and replace an older version in order to upgrade it.
However, if you go to Appearance > Themes > Add New and try to upload a new version of a theme that is already in your site’s themes directory, it will fail and you’ll get an error message telling you the destination folder already exists.
The reason for this error is due to the fact you can’t have two folders in your themes directory with identical names (obviously!).
There are a couple of simple solutions:
- Login to your site via FTP or cPanel and delete the old theme and then upload the new version. Make sure you make a backup of the old version of your theme just in case something goes wrong.
- If deleting your old theme makes you nervous, another option is to rename the old version of the theme. This will allow you to successfully upload the new version of the theme.
- Login to your site via FTP or cPanel and navigate to wp-content/themes/ and find your old theme.
- Rename your old theme something like “theme-old” (replacing “theme” with the name of your theme).
- Upload your new theme.
The old and new versions of the theme will both appear in the themes interface, but you will be able to distinguish them by their folder names and version numbers.
Upgrading a Customized Theme
Have you ever spent countless hours customizing your site, only to lose all of your hard work after updating the theme?
You probably discovered afterwards that you should have created a child theme.
A child theme is a theme that inherits the functionality of another theme, called the parent theme. Child themes allow you to modify or add to the functionality of the parent theme.
Most importantly, creating a child theme lets you make changes to your site without touching your original theme’s code, allowing you to update your site without the threat of lost all the customizations you’ve made.
You can find out more about how to create a child theme in our article How to Create a WordPress Child Theme.
If you want to upgrade your theme but made customizations without using a child theme, read on.
Uploading Only Changed Files
If you’ve made changes to your theme’s code, you may want to see if the updates in the new version of your theme are extensive.
If your theme’s developer has published a list of changes in the new version in a changelog or a readme file and only a file or two have been changed, you may opt to just upload and overwrite the files in the older version via FTP or your cPanel.
Sign up for more
If any of the updated files happen to be ones you’ve customized and you remember which lines of code you’ve changed, you can make the customizations again via Appearance > Editor.
Re-customizing Your New Theme
If you remember all the customizations you made to your theme or you’ve saved them somewhere, the easiest way to re-customize it to automatically upgrade it as per the methods above and then make the customizations to your site again.
Yes, it’s annoying to have to make all the customizations a second time, but at least this time you can implement a child theme so you don’t have to worry about doing this again.
Make sure you make a backup of your site before doing this so you can revert to your old theme if something goes wrong.
What If I Can’t Remember My Customizations?
If you haven’t saved your customizations somewhere or you can’t remember what changes you made, don’t stress! It makes it harder to upgrade your theme, but it’s still possible.
There are programs that can help you compare two version of your themes, i.e. your old version versus your old customized version, or your old customized version versus the new version.
Let’s take a look at how to compare two versions of a theme using Kaleidoscope. Since this program isn’t free, you may want to search for free or cheaper alternatives, though Kaleidoscope does have a 15-day trial period if you want to try it out.
1. Copy your old theme and the updated version to your desktop so you can easily access your files. Open Kaleidoscope and drag and drop in the files you want to compare.
2. The program will display the text in both files side-by-side so you can compare changes.
In this example, I discovered a code snippet I had added to the bottom of my old functions.php file.
3. You can change copy any code in the old file into the new file. Click on a block (the section in pink) and at the bottom of the window click on “Copy to right.” The text from your old file on the left will automatically copy over to your new file on the right.
4. Repeat these steps until you have copied over all customizations. When you’re done, zip up the old theme and upload it to your site via Appearances > Themes > Add New.
Upgrading themes to the latest version ensures you have not only the most feature-rich version, but all the most secure.
Whenever you do update your themes, always make a backup of everything – your old theme, database and new theme. If something does go wrong while you’re editing you’re file, you will have a backup available so you can start the process again without losing any important files.