WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've already looked at this question and didn't find it too helpful.

We're using Wordpress as a CMS that also includes a blog/news section. The blog/news uses WP "posts" and those are made whenever and are j

We're already using version control for the files, so that's simple enough. The main issue is the database. We basically want a selective backup that excludes posts. Are there any best practices or well tested ways to do this?

I'm comfortable enough with sql (not specifically MySql, but the dialects are similar enough I'd think) that I could come up with a script to do it, but I'd rather not risk subtle errors if there's already a well-tested solution available.

If there isn't already a solution, are there any caveats or pitfalls I should be aware of when doing this? Any relevant articles that would be helpful in preparing this?

share|improve this question

Hi @Davy8:

It's a hard problem to solve. Would this answer be any more helpful?

I know it's not a perfect solution, but it is a start.

P.S. I'm working with some others to solve the bigger problem with a plan to release as part of a GPL-licensed product. We are looking for people who have this need to help us define the requirements. If you are interested in detailing your specific needs and letting me or others ask you some more detailed questions please contact me via the email in my profile. We just don't want to build something and then find out it's not what people want or need.

share|improve this answer
Unfortunately that doesn't migrate data at all it seems, so that isn't very helpful to me. It handles the url change, which we're already getting around by setting it in wp-config.php to override the db value. It's less than ideal but it's not a huge pain to keep every file other than wp-config in sync. The bigger issue is the database. Specifically that posts will be made directly in production and not staging, and those should not be overwritten by the data in staging. However everything else should be. – Davy8 Dec 29 '10 at 15:51
@DavyB - Correct, it doesn't migrate. That's a harder problem nobody as seemed to solve yet except for complete export then import. Point of note: The plugin I presented does more than streamlining wp-config.php; it cleans up all the embedded URL data as well as anything else that's domain dependent like Google Maps API keys. It's a necessary part of the solution. Lastly I'm working to solve exactly the staging-data-not-overwriting-live-data problem but need to learn what workflow other people find acceptable. Dialog via email? My email is in my profile. – MikeSchinkel Dec 29 '10 at 18:40

You might want to look at mysqldump. I haven't used it so I can't vouch for ease-of-use, but it's a mysql utility for copying DBs, and it has an "ignore-table" option that lets you skip tables.

Another approach might be to copy the DB in full, but have a script that runs immediately after the backup that cleans out the post table.

share|improve this answer
One issue with that (I should've mentioned it in the question) is that posts and pages are in the same table, there's just a column that specifies what type they are. There's a -where parameter to mysqldump and I'll probably look into that. – Davy8 Dec 29 '10 at 13:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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