The WordPress project is charging full steam ahead with improvements to the customizer. The most recent release featured the addition of dynamic and contextual controls, sections, and panels. As WordPress 4.2 is kicking off development, core contributors are looking to add menus to the customizer for easy management from the frontend.
More WordPress theme developers are adopting the native customizer to add options to themes, as it provides a standard interface with which users are familiar. One feature that is missing is the ability export and import customizer settings, an option that many pre-customizer theme panels have readily available.
Customizer Export/Import is a plugin that addresses this need by adding the ability for users to export/import settings from any theme or plugin that makes use of the customizer. You’ll need to have the same theme (or plugin) installed on both sites where you are performing the export/import. The export file is named after your theme and you can use it to import the settings for the same theme (or child theme) on another site.
The plugin was created by Justin Busa, a web developer and co-founder at FastLine Media. After spending quite a bit of time with the customizer while migrating a theme options page over to it, Busa was inspired to solve the problem of import/export.
“One of the pieces that had to be migrated was the ability for users to export or import their theme settings,” he said. “That’s a pretty common feature of themes that have a custom options page, but not one that can be standardized since each theme typically has its own way of handling options.”
As he began building export/import functionality for his own theme, he found that it could benefit more developers as a general tool. “I quickly realized that was something that could actually work with any theme. I did some research to see if something like this already existed and it turns out that it didn’t.”
Reusable Configurations for Themes and Plugins
Busa believes that developers who build WordPress sites are most likely to be the ideal users of this plugin as a tool to streamline the process. “This plugin will allow people building many WordPress sites to save different configurations for their favorite themes and reuse them again and again,” he said. “It could also be as simple as exporting the settings you used on a previous site to start a new similar site.”
Theme authors can also add support for the plugin in order to avoid having to spin up their own export/import functionality, as Busa is doing with his current theme. The Export/Import panel in the customizer will prompt the user to install the plugin if he hasn’t already. “Additionally, theme authors could potentially offer any number of presets for their themes that users could import by leveraging this plugin,” Busa said.
Customizer Export/Import is designed to work with any theme or plugin that makes use of the customizer. Busa notes that it does not, however, export settings that aren’t stored in the database as theme mods, which means that it doesn’t currently export widgets, menus or settings such as the built-in “Site Title & Tagline”. The export file output by the plugin contains a serialized dump of mods retrieved using the get_theme_mods function.
“We’ve tested it with many popular themes that use the customizer, including Genesis, Make, and Twenty Fifteen, and it works great,” he said. Busa is not sure if adding the ability to import widgets and menus from other sites makes sense.
“For example, the pages in a menu might not be on the destination site or the widgets in a sidebar might not be installed,” he said. “My initial thinking is that if you need that level of export/import functionality, you’re probably better off with a heavier solution like WP Migrate DB Pro. I’ll be keeping an eye on feedback before making a decision there.”
The Customizer Export/Import plugin is available on WordPress.org. If you are a theme developer or user who finds the plugin to be valuable, make sure to send Busa feedback via the project page on GitHub.