Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've been storing all my theme options using Settings API for some time now and it's lacking one functionality.

I have multiple pages (different servers) using my custom themes and I would love to move settings between them, I mean I'd like to export all the Settings API fields values from theme 1 and import them to theme 2.

Are there any plugins out there / any ideas how to achieve that?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I just came across this wp.tuts tutorial a few days ago:

Creating a Simple Backup/Restore Settings Feature
Lee Pham on Jun 22nd 2012
In this tutorial, I’m going to show you how to create a simple backup/restore feature for your WordPress blog. With this feature, you can backup all options to another place, that you can restore them from at any time without configuring them again.

It's wrapped as plugin, so you can jump straight to testing.
As it is, it exports all the site options using the function get_alloptions. So, the first thing is change that to your own option - supposing you are following the best practice of having all of them into a single serialized value.

Works quite nice :)

share|improve this answer

Your theme options should be stored in the *_options table. A key name that looks like theme_mods_* plus the theme slug should be pretty common. That prefix is hard-coded into /wp-includes/theme.php. Twenty Eleven also uses twentyeleven_theme_options. Point is, you should be able to find your theme options and swap the key names or copy the options to another key name for another theme. Either of those is a pretty simple SQL query.

I am not sure it makes sense for themes to share options though. Different themes probably require different options. It seems like a pretty good way to make a mess to me. You'd probably need to build some kind of sanity checking for your options to make sure you don't introduce incompatible configuration values.

share|improve this answer

Your Answer

 
discard

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.