Let's say theme 1.0 is installed with 30 files in it. Then two weeks later theme is upgraded to theme 2.0 which contains only 10 files. Do those older 20 files get automatically deleted after upgrade?

What I wanted to do is to place a file inside the theme directory, trough which the user can customize the theme. This file would be created after the theme is installed trough the theme settings. But if WP does delete files that do not exist in the official theme package, then this file would be deleted as well...

3 Answers 3



Find a theme that support Child Theme. Create a child theme so that your modification doesn't get deleted if you update the parent theme.


Two options:

Child Themes

Distribute a set theme that you plan to update. Auto-updates will replace this theme, so it should not be customized. Build a child theme on top of it to hold your customizations.

A great example is the Genesis Framework. Genesis is an advanced parent theme that lives in your /themes/ directory and is occasionally updated automatically by the team at StudioPress. Your live site, though, will use a child theme that inherits and customizes the behavior of Genesis.

Theme Options

If the customizations are minimal enough (i.e. a few lines of custom CSS) you can store them in the option table. You can build a theme settings page with buttons, checkboxes, and dropdowns for simple settings. Freeform CSS can be edited in a textbox and stored in the database as well.

These options will exist separately from the theme and will not be overwritten by theme updates.

Note: This isn't an optimal solution since it separates part of the theme definition and stores it in the database. Though it would accomplish some of what you're looking for, I'd strongly recommend the child theme route instead.

  • yes, I'm using the theme options to allow extra css rules to be added, but I want to do the same for php code (like a user functions.php file). Right now I store it in the options table like the CSS, and eval it, which is wrong in so many ways :) Storing the code in a php file and including it is a better solution... I know about child themes, but this is a theme I'm developing and plan to distribute it, so I can't force people to create child themes. I actually included a child theme inside one theme and people were still making changes to the parent theme code... Mar 18, 2011 at 22:43
  • ...maybe I should place the php file inside /wp-content/uploads/... Mar 18, 2011 at 22:44

Looks like there's talk for the 3.2 roadmap of improving the upgrade system so that it only affects changed files, but thats a long way off and might only affect core upgrades. Plugin and theme upgrades do delete the entire folder and overwrite it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.