Overview
ThemePlus includes a built-in Import / Export system accessible from the options panel. It lets you export all saved theme options to a JSON file and import them back at any time — on the same site or a different one. Use it to back up settings before making major changes, migrate settings between staging and production environments, or share a configuration across multiple sites running the same theme.
The Import / Export panel is located in the last tab of the ThemePlus options panel, labeled Import / Export.
Exporting Settings
The exported file contains all currently saved option values as a flat JSON object keyed by option ID.
Example export file structure
{
"primary_color": "#2271b1",
"secondary_color": "#646970",
"body_typography": {
"font-family": "Inter",
"font-weight": "400",
"font-size": "16",
"line-height": "1.6",
"letter-spacing": "0",
"text-transform": "none",
"font-style": "normal",
"subsets": ["latin"]
},
"enable_preloader": true,
"header_layout": "standard",
"logo_image": {
"id": 42,
"url": "https://example.com/wp-content/uploads/logo.png",
"width": 300,
"height": 100,
"alt": "My Logo",
"title": "Logo"
},
"social_links": [
{ "platform": "github", "url": "https://github.com/yourhandle" },
{ "platform": "instagram", "url": "https://instagram.com/yourhandle" }
]
}Importing Settings
Important: Importing will overwrite all current settings. Export your current settings first if you want to keep them.
Programmatic Export
You can retrieve all saved options in PHP using the helper function:
$all_options = themeplus_get_option();
$json = wp_json_encode( $all_options, JSON_PRETTY_PRINT );Triggering a download via a custom admin page
add_action( 'admin_post_mytheme_export_options', function() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( 'Unauthorized', 'your-textdomain' ) );
}
check_admin_referer( 'mytheme_export_options' );
$options = themeplus_get_option();
$filename = 'themeplus-export-' . gmdate( 'Y-m-d' ) . '.json';
header( 'Content-Type: application/json' );
header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
header( 'Pragma: no-cache' );
echo wp_json_encode( $options, JSON_PRETTY_PRINT );
exit;
});Programmatic Import
You can import settings in PHP by writing directly to the options table. ThemePlus stores all values under a single WordPress option keyed by your opt_name.
function mytheme_import_options( array $new_options ): bool {
$opt_name = 'mytheme_options'; // Your opt_name value
$current_options = get_option( $opt_name, [] );
// Merge new values over current — remove array_merge to replace entirely
$merged = array_merge( $current_options, $new_options );
return update_option( $opt_name, $merged );
}Importing from an uploaded JSON file
add_action( 'admin_post_mytheme_import_options', function() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( 'Unauthorized', 'your-textdomain' ) );
}
check_admin_referer( 'mytheme_import_options' );
if ( empty( $_FILES['import_file']['tmp_name'] ) ) {
wp_safe_redirect( admin_url( 'themes.php?page=mytheme-options&tab=import_export&error=no_file' ) );
exit;
}
$file = $_FILES['import_file']['tmp_name'];
$content = file_get_contents( $file );
$options = json_decode( $content, true );
if ( ! is_array( $options ) ) {
wp_safe_redirect( admin_url( 'themes.php?page=mytheme-options&tab=import_export&error=invalid_json' ) );
exit;
}
$opt_name = 'mytheme_options';
update_option( $opt_name, $options );
wp_safe_redirect( admin_url( 'themes.php?page=mytheme-options&tab=import_export&imported=1' ) );
exit;
});Resetting to Defaults
The Import / Export tab also includes a Reset to Defaults button. Clicking it clears all saved option values and restores the defaults defined in your field registrations.
This action cannot be undone. Always export your settings first if you may want to restore them.
Programmatic reset
function mytheme_reset_options(): bool {
$opt_name = 'mytheme_options'; // Your opt_name value
return delete_option( $opt_name );
}After calling delete_option(), ThemePlus will use the default values defined in each field registration on the next panel load.
Use Cases
Before a major redesign — Export current settings, make changes, and restore the export if the new direction does not work out.
Staging to production migration — Configure and refine settings on a staging site, export, then import to production in one step.
Multi-site deployments — Set up one site, export, and import the same configuration across multiple sites running the same theme.
Onboarding a new client — Provide a pre-configured JSON export file alongside the theme so clients start with sensible defaults already in place.