3 Easy Simple Ways To Update Your WordPress Theme Without Losing Any Customization
WordPress experts always recommend WordPress based website owners to update their WordPress themes to the latest version. It ensures your theme possesses all the latest features and is up-to-date with security patches.
You can update your WordPress theme by many ways. In this post, I’ll explain various methods to do the same without losing the customization you made to it.
Note: Before making any changes on your site or updating your theme, make sure you back up your site (you can do in your hosting cpanel), so in case something goes wrong you can easily revert it back to normal. You’ve been warned!
OK, so let’s get started.
Updating themes automatically
Whenever a new version of your WordPress theme is released, WordPress dashboard will notify you to update your theme to the latest version.
You can update it by clicking the update now button by navigating to Appearance > Themes in your WordPress dashboard.
Since the release of WordPress 3.7, it allows you to automatically upgrade your WordPress theme without having to update it manually, so you can make sure that you always use the latest version.
To automatically update your theme, all you need to do is to add the following code snippet to your functions.php file.
add_filter( ‘auto_update_theme’, ‘__return_true’ );
This feature will only work for the themes that are downloaded from WordPress official theme directory. If you’re using WordPress themes downloaded from a third-party website, make sure you follow their instructions for updates.
1) Using a child theme
While updating your theme automatically is the easiest way to ensure that you get the latest version of your theme with enhanced functions and most importantly security fixes, it is not recommended for you especially if you’re not using a child theme and made all the customization on your parent theme.
As you may know, one of the biggest benefits of using WordPress is that it is very flexible out-of-the-box, so you can easily enhance its features by simply adding a code snippet to your functions.php file.
In an attempt to enhance the features, most beginner WordPress users simply tweak their parent theme file by directly customizing the CSS or functions.php files. This is a wrong practice to follow.
First of all, when you update your theme, you’ll lose all the tweaks you made to it. Secondly, automatic updates can even make your site broken.
How do you preserve all the tweaks without breaking your site?
It is by using a child theme.
If you’re using a child theme, you can make any customization on it without touching the parent theme, so you don’t lose anything while updating the parent theme.
Even if you’re not a developer, you can easily learn how to create a WordPress child theme.
That said, not everyone will require a child theme. If you’re planning only for making slight changes to your CSS files, you can either create a custom CSS file or install and use a plugin like custom CSS, so you don’t need to create a child theme.
For example, this site is built on a child theme for Genesis framework so even if there’s any update for our Genesis framework the customization wouldn’t be lost.
To sum up, if the changes are extreme, it is better to create a child theme.
2) Preserving your tweaks if you’re not using a child theme
What if you’re not currently using a child theme and did customization on your parent theme already? How do you preserve the customization even after updating it?
One of the solutions is to simply copy the tweaks and paste it to your latest theme after updating it. However, the problem here is you don’t always identify all the tweaks you made. Then, how do you identify it and replicate it to your new theme?
You can identify the changes by comparing the current theme with the latest theme. Once you identified it, you’ll need to copy and replicate it to your new theme.
3) Updating your WordPress theme to preserve the tweak
Step 1: Download your current theme and the latest theme to your computer.
Form WordPress dashboard, you can’t download your current WordPress theme by default. You’ll either need to have an FTP access or need to use WP File manager plugin.
If you’re using a file manager plugin, you can download the theme directly from your WordPress dashboard. I know the plugin I mentioned here hasn’t been updated for last 3 years, but I still use it on my own sites and many of my clients’ sites because it still works like magic!
After downloading your current theme, you’ll need to download the latest version of your theme from the official WordPress directory.
Step 2: Use a file comparison software to compare your current theme with the latest version
Once you installed it on your computer, open both the themes on WinMerge to compare. WinMerge will show a list of directories and files in both your themes. It will also show you which files are new and which files are not identical.
Step 3: Compare and copy the tweaks.
Right-click on a file and click Compare to see the changes on both themes. You can easily identify what changes you’ve been made to your current theme. Now that you found the changes, all you need to do is to copy the tweaks to the latest version of your theme. Once done, overwrite your current live theme by uploading it to your WordPress theme directory using FTP or WP File manager plugin.
That’s it! Once done, verify whether the tweaks are retained on your site and everything works fine.