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?
I just came across this wp.tuts tutorial a few days ago:
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 🙂
Your theme options should be stored in the
*_options
table. A key name that looks liketheme_mods_*
plus the theme slug should be pretty common. That prefix is hard-coded into/wp-includes/theme.php
. Twenty Eleven also usestwentyeleven_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.