Skip to content

WordPress Customizer settings lost after theme switch: recovery

Customizer settings in WordPress are scoped to the active theme. After a theme switch they appear lost — but they're still in the database. The recovery procedure.

A WordPress site under managed WordPress operations has years of accumulated Customizer settings — typography choices, header colors, footer text, the logo upload, dozens of widget configurations. The team decides to switch from the old theme to a new one. After activation, the Customizer opens to all defaults. Typography is gone, colors are gone, the header text reverted to the site name. The team panics, assumes the settings were destroyed. They were not — they are still in the database under the old theme’s storage key. The recovery procedure below walks through getting them back, fully or selectively.

What’s happening

WordPress stores Customizer settings in the wp_options table under a key named theme_mods_<theme-slug>. Each theme has its own slot. When you activate a different theme, WordPress reads from a different slot — the previous theme’s settings are not touched, just no longer the active reference. Also stored in wp_options: widget_* keys for widget content, sidebars_widgets for widget placement, and theme_mods_<old-theme> containing everything from the Customizer of the previous theme.

If the old theme is still installed, you can switch back temporarily to see the settings, copy them out, and recreate them on the new theme. If the old theme is deleted, the theme_mods_<old-theme> key still exists in wp_options — you can read it directly from the database and migrate values selectively to the new theme’s slot. The settings are never lost. They are scoped, which is different.

How to verify

Inventory what is in the database for both old and new theme slots:

# the old theme's settings (replace with actual old theme slug)
wp option get theme_mods_old-theme-slug --format=json | jq .

# the new theme's current settings
wp option get theme_mods_$(wp theme list --status=active --field=name) --format=json | jq .

# all theme_mods keys ever stored
wp db query "SELECT option_name FROM wp_options WHERE option_name LIKE 'theme_mods_%';" --skip-column-names

# widgets (these are theme-independent, but worth checking)
wp option get sidebars_widgets --format=json | jq .

Identify which settings you care about. Custom logo, colors, typography, custom CSS in the Customizer’s “Additional CSS” — these are theme-scoped. Site title, tagline, blog name, blog description — these are theme-independent and survived the switch.

The Customizer “Additional CSS” deserves special attention. It lives at theme_mods_<theme>['custom_css_post_id'], which points to a post in wp_posts with post_type=custom_css. If you switch themes and want to preserve the Additional CSS, you need to copy the post or update the new theme’s pointer.

The fix

The recovery procedure:

  1. If the old theme is still installed, activate it temporarily on staging (not production) and export the relevant settings:

    wp theme activate old-theme-slug
    wp option get theme_mods_old-theme-slug --format=json > /tmp/old-mods.json
    wp theme activate new-theme-slug

    You now have the old settings in a file you can read and selectively transfer.

  2. If the old theme is deleted, the settings are still in wp_options:

    wp option get theme_mods_old-theme-slug --format=json > /tmp/old-mods.json
    cat /tmp/old-mods.json | jq .
  3. Selectively migrate settings to the new theme. The Customizer keys map roughly between themes (most themes use nav_menu_locations, custom_logo, header_textcolor, background_color). Copy what makes sense:

    # copy the custom logo
    OLD_LOGO=$(wp option get theme_mods_old-theme-slug --format=json | jq -r '.custom_logo')
    wp option patch update theme_mods_new-theme-slug custom_logo $OLD_LOGO
    
    # copy the Additional CSS post pointer
    OLD_CSS_POST=$(wp option get theme_mods_old-theme-slug --format=json | jq -r '.custom_css_post_id')
    wp option patch update theme_mods_new-theme-slug custom_css_post_id $OLD_CSS_POST
  4. For settings that do not map directly (the new theme uses different keys for typography or colors), open the new theme’s Customizer, manually re-enter the values from /tmp/old-mods.json. This is the work you cannot avoid.

  5. Widgets are theme-independent, but widget placement (sidebars_widgets) is keyed by sidebar ID, which differs between themes. If the new theme defines sidebar-1 and the old theme defined footer-widgets-1, the widgets will appear in wp_options but be assigned to a sidebar the new theme does not register. Re-place them in the Widgets screen.

  6. Save the migration by exporting the new theme’s complete theme_mods after manual re-entry. This export goes into the WordPress hosting backup set:

    wp option get theme_mods_new-theme-slug --format=json > /tmp/new-mods.backup.json

For WordPress sites where theme switches happen routinely (agency portfolios, multisite networks), Stack Harbor handles Customizer migration as part of managed WordPress operations. Book a WordPress consult if your team is planning a theme switch and wants the Customizer settings preserved without manually re-entering them.