Keeping theme modifications when updating WordPress

Ways to keep the modifications to your theme when updating WordPress

When you update a theme, the old files of the already installed theme are overwritten with the new ones. This may not concern you, if you haven't made any changes to the code of the theme's files, or you don't plan to make any, but if you have, it will be frustrating to lose all the modifications.

If you have just a few modifications there is always the option to make them again after the update, but if you have more, that won't really do.

If you're using the base WordPress theme (Twenty Ten) that comes prepackaged with the whole WordPress installation archive, its files will also be overwritten if you upgrade WordPress using the automatic upgrade. They can be kept intact if you do the upgrade manually and upload all the new files, except the ones for the theme. For more information on this see the upgrade tutorial.

In any case, if you plan to make many modifications to your theme (no matter which one it is), or you have already made some, there are several ways to make sure that they don't get overwritten during an update.

  • One way to deal with this is to create a new folder in the themes directory of the WordPress installation on your hosting account and copy all the contents of the modified theme's folder to the newly created one. For example, if you have uploaded WordPress in a folder called wordpress and you use the theme Twenty Ten, the path to it on your HostKnox account would be public_html/wordpress/wp-content/themes/twentyten. So you need to copy what's inside the twentyten folder and paste it in the new folder that you have created in the themes directory. You can name the new folder anything you like (e.g. twentyten_mod). Don't forget after that to activate your new custom theme from your Dashboard (Appearances>Themes). Now you don't have to worry about your modifications and can make many more. This is a good option if you already have made many changes to your theme.

  • A similar option is just to rename the folder for the particular theme to something else.

You can do all these things with an FTP client or through SSH.

  • Another way to keep your modifications is to create a WordPress child theme. This is especially useful if you still haven't done any modifications, but you plan to make some, or as many as you like.