Title: Database removed when theme is updated
Last modified: August 22, 2016

---

# Database removed when theme is updated

 *  [Demeters Harvest](https://wordpress.org/support/users/demeters-harvest/)
 * (@demeters-harvest)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/database-removed-when-theme-is-updated/)
 * I asked this in the HB-Themes support forum, but they haven’t helped at all, 
   so I’m hoping someone here can tell me if there’s a place or way to make it so
   a database isn’t removed every time there’s an update of a theme. I use Enigma
   on one site (FoulBallz.com) and have no issues with theme updates. But on DemetersCrop.
   com every time I update the theme, I have to manually re-load the database. It’s
   annoying!
 * So I’m wondering if there might be a different place to put custom scripts other
   than within the theme directory. The reason it was done the way it has been is
   because when my database guy started the foulballz project he saw that the previous
   developer had put the odds calculator in the theme directory, so he did it the
   same way. Maybe there’s a way to put it outside the theme directory and somehow
   make the theme aware that a custom script exists somewhere else.
 * Any thoughts? This is annoying as can be to have the database constantly re-loaded.
   No other theme does this. I’m hoping there’s a WordPress specific work around.
   
   Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Jon (Kenshino)](https://wordpress.org/support/users/kenshino/)
 * (@kenshino)
 * Lord Jon
 * [11 years, 2 months ago](https://wordpress.org/support/topic/database-removed-when-theme-is-updated/#post-5846408)
 * When you update your theme, WordPress deletes the theme folder and reloads the
   new theme.
 * Hence any changes or additions to the theme will get removed.
 * You have 2 options.
 * Put the calculator in a plugin and install it.
 * Use a child theme ( [http://codex.wordpress.org/Child_Themes](http://codex.wordpress.org/Child_Themes))
   and put the calculator in it so that when you update the current theme (which
   becomes the parent theme ), the child theme is unaffected.
 *  Thread Starter [Demeters Harvest](https://wordpress.org/support/users/demeters-harvest/)
 * (@demeters-harvest)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/database-removed-when-theme-is-updated/#post-5846411)
 * Sorry. I should have clarified I forgot to mention the site it’s happening on:
   DemetersCrop.com. You see the USDA Db.
 * And to clarify: It DOESN’T happen on the FoulBallz.com site. I have updated that
   site dozens of times and the database is ALWAYS there. That uses the Enigma theme.
   I’ve also had no issues with any other theme. They ALL keep the database, all
   except this “Highend” theme.
 * Again, sorry. I should have been more specific.
 *  [Jon (Kenshino)](https://wordpress.org/support/users/kenshino/)
 * (@kenshino)
 * Lord Jon
 * [11 years, 2 months ago](https://wordpress.org/support/topic/database-removed-when-theme-is-updated/#post-5846492)
 * If you want to prevent your theme from wiping out the file that likely controls
   this calculator and the database associated with it, try the methods I suggested.
 *  Thread Starter [Demeters Harvest](https://wordpress.org/support/users/demeters-harvest/)
 * (@demeters-harvest)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/database-removed-when-theme-is-updated/#post-5846494)
 * Again, the calculator and database on FoulBallz.com DOES NOT disappear. THAT 
   theme is fine AND the script is located IN the theme.
 * The database I am talking about it on DemetersCrop.com. It is NOT a calculator.
 * The issue is, that I have one site that has the database in the theme (FoulBallz.
   com) that does NOT disappear and disconnect. Then I have one (DemetersCrop.com)
   that when the DB is placed in the same spot, and the theme is updated, the DB
   is disconnected.
 * Thus, there’s a way to make DemetersCrop.com’s DB not disconnect like how the
   DB on FoulBallz does NOT disappear when the theme is updated. Also the calculator
   isn’t even a database! It’s a plug in on the back end.
 *  Thread Starter [Demeters Harvest](https://wordpress.org/support/users/demeters-harvest/)
 * (@demeters-harvest)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/database-removed-when-theme-is-updated/#post-5846500)
 * Also, that child theme is well beyond my capabilities.
 *  [Jon (Kenshino)](https://wordpress.org/support/users/kenshino/)
 * (@kenshino)
 * Lord Jon
 * [11 years, 2 months ago](https://wordpress.org/support/topic/database-removed-when-theme-is-updated/#post-5846505)
 * Updating a theme wipes any customisation unless you have a Child Theme.
 * To be clear – your scripts or whatever is connecting the database is being wiped
   because you put the custom script into the theme folder. The theme folder gets
   wiped when it is updated. So you lose ALL customisations.
 * Why your other site doesn’t do that is not something I can be sure of. Perhaps
   it is one of the theme frameworks that only updates certain files when you update
   the FrameWork. But such themes utilise their own update function, not the one
   WordPress uses.
 * I also do not know what database you’re talking about and how it is connected.
 * It sounds like you need professional help if child themes are beyond your capabilities.
 * Try posting at [http://jobs.wordpress.net/](http://jobs.wordpress.net/)
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [11 years, 2 months ago](https://wordpress.org/support/topic/database-removed-when-theme-is-updated/#post-5846507)
 * Here’s the problem.
 * > So I’m wondering if there might be a different place to put custom scripts 
   > other than within the theme directory.
 * When you put anything in the theme directory and upgrade then yes, you will lose
   all your work every time. Sorry, but that’s how the theme upgrade mechanism works.
 * If you wish to keep your files/changes/additional work then you have no choice:
   create and activate a child theme.
 * [https://codex.wordpress.org/Child_Themes](https://codex.wordpress.org/Child_Themes)
 * _Or_ you could implement your scripts in custom plugins. But the child theme 
   is a much easier solution to work with. 😀

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Database removed when theme is updated’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [theme updates](https://wordpress.org/support/topic-tag/theme-updates/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/database-removed-when-theme-is-updated/#post-5846507)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
