WordPress Migrating Parent to Child Theme Customizer Settings

If you already have a WordPress theme and have used the customiser to change some settings, then creating a child-theme for more advanced modifications usually means loosing your customisations, or adding them again – Migrating parent to child theme customiser settings means that you don’t loose your customizations.

Method1: using a customizer import/export plugin

simply go to plugins > add new > search for “Customizer Import/Export” > install and activate the plugin.

Now you can go to the regular customizer and at the bottom, click Export. make sure to save the file.

To import the parent theme settings into a child-theme, simply activate the child theme, goto customizer and then import your file saved in the previous step.

Method2: transfer theme options to child theme using WP-CLI

if you have wp-cli installed (you really should have) then you can copy child theme settings from parent theme without a plugin:

# save the existing theme settings
wp option get parent-theme-name --format=json > parent-theme-name.txt

# transfer theme options to child theme
wp option update child-theme-name --format=json < parent-theme-name.txt

# cleanup the temp file
rm -f parent-theme-name.txt

sources:

https://wordpress.stackexchange.com/questions/163440/preserving-theme-settings-in-child-theme

https://siteorigin.com/migrating-parent-child-customizer-settings/