Updating is relatively easy and straightforward if you haven’t customized your theme, but what if you have? When the theme is customized you have to plan ahead and prepare your site for each update. This can be rather annoying and time-consuming but in the end still better than always running the outdated version of the theme.
It’s time to update, what to do?
- First step before every update is to backup your theme files and database:
Theme files – to backup theme files just download them from your server to your hard drive. Open this article for details on how to do that.
Database – check out the official WordPress backup article for instructions
- Download the latest version of your theme from member area to your hard drive and extract it using software like 7-Zip.
- Activate a maintenance plugin so people can’t access your site during the update. Do that by going to Plugins ⇨ Add New and searching for “Maintenance Mode” or “Coming Soon”.
- Connect to your server and navigate to the /wp-content/themes folder. For help regarding this step please read/watch the following tutorial.
- To overwrite the existing theme drag the theme folder from your hard drive to the /wp-content/themes folder on the server. If asked to overwrite, hit Yes. This step will delete all your themes customizations so make sure you have everything backed up
There is a small trick with which you can backup theme files and update in the same go. When it’s time to update do this:
0. Let’s assume the name of your active theme is “MyTheme”.
1. Rename the folder on your hard drive to MyTheme_new and upload it to the server.
2. Rename the current theme folder to MyTheme_old.
3. Do not visit the wp-admin area between steps 3 and 4.
4. Rename the MyTheme_new folder back to the original theme name – MyTheme.
Be careful; at the end of the process the name of the active theme (folder) must be the same as it was when you started. In our case, that’s “MyTheme”
- If your site isn’t customized you are done – the theme has been updated, feel free to stop reading. If your site is customized your theme is updated as well, but you need to retrieve the customizations, please continue reading
- Assuming you know which files are customized.. open change_log.txt file included inside the theme root folder and see what was updated since the last version. If a file you customized isn’t mentioned in the change_log just upload it to the server (replace it with the new/updated file). If however you see that one of the files you customized has been updated do one of these three things:
- Upload the file back to the server without doing anything (not recommended)
- Redo the customization in the new file
- Compare the two files using services like DiffNow or programs like WinMerge to see what are the differences. You can then either redo the customization inside the new file or apply the updated code in your customized file.
- Once you upload all your customized files back to the server you are officially done with the update! Congrats!
To make future updates easier we recommend the following
- Use custom.css for all design (css) customizations. With custom.css you can customize your css files much much easier. Instead of connecting to your server and updating each file separately you have this one file (accessible from Appearance -> Editor) which you can edit to customize your site. To learn more about custom.css please click here. Our advice is to use custom.css whenever you can. Things like hiding elements can be done both with css and in actual php files. It’s much easier to backup one file (custom.css) compared to several php files.
- Unfortunately not everything can be customized with custom.css, sooner or later you’ll find yourself customizing a php file. We recommend creating a folder on your hard drive and keeping track of each file you customize. That way when it comes time to update you already have all your customized files backed up and ready to go. This folder will also come in handy if (knock on wood) something happens to your site and you lose all your theme files. Stock theme can always be downloaded from the member area, but if you don’t back them up – your customized files could be lost forever.