Updating a WordPress Theme that Has Been Edited

Posted on May 08 2014 by in Blog 

WordPress is known for the level of customization that you can perform with your websites. There are thousands of themes and plugins that provide most users with exactly what they are looking for. Despite this, there are times when it is necessary to edit the core files of a WordPress theme. For example, there may be certain styling options that are not available with the theme you are using or you have to add a function to the functions file. When you edit the core files of your WordPress theme, you need to be careful when updating your WordPress theme. There is a good chance that any changes you made will be overwritten during the update.

Backup Your WordPress Website

This should go without saying; though, it is possible to overlook this step. Whenever you update your WordPress theme, or any aspect of WordPress, you should backup your website. WordPress has their own backup options; however, some prefer to use a backup plugin to ensure everything is saved exactly the way it is. So, before updating your theme, perform a backup first.

Copy All Your Changes

After backing up your WordPress website, copy all of the code that was changed in the files of your WordPress theme. As you copy this code, make a note of which files they were included in. The easiest way to do this is to open a text editor and create a list of all of the files that you have changed. From there, underneath the name of each file that you edited, copy the code that was altered from that file. Save this text file somewhere where you will not lose it.

Update Your WordPress Theme

You are now ready to update your WordPress theme. Go through the standard process of updating your WordPress theme and while you are at check to see if there are any other updates that you need to perform. It is often a best practice to perform any necessary updates all at once. So, if you need to update your WordPress installation or any of your plugins, do so now.

Start Entering Your Custom Code

With your WordPress theme updated, find the files that you had previously edited. Going through the text file that you saved, enter the code into your core WordPress theme files one at a time. Save each file when finished and follow this procedure until you have entered all of your custom code.

Test Your WordPress Website

Hopefully, everything worked correctly and all of your updates were successful. Test your WordPress website and ensure that your custom coding is still intact. In general, you should not run into any problems; though, there are occasions where the update to your WordPress theme will include changes that affect your custom code. If this is the case, or you run into any other errors, revert back to the version of your website that you backed up and perform the updates again. When this happens, you will need to look into other ways to provide the customization that you originally added. WordPress is very flexible and with the update to your theme, they may have included an easier way to take care of the customization you are hoping for.