A problem with the theme customizer and child themes

In response to the recent change to require the use of the customizer for theme options, Puneet Sahalot brings up an issue with the way saving options works by default when using the customizer:

To use the Live Preview feature,ย we need to use 'type' => 'theme_mod'ย  and then bind it with the customizer js. Now, the problem is theme_mod is specific to the currently active theme. Which means that the current themeโ€™s data/settings/options can not be accessed by another theme.

Whereas with get_option(), all the data is globally accessible.

Because of theme_mod approach, the problem comes in when you build a child theme. Since the data was earlier saved specific to the parent theme, it becomes unusable to the child theme. If you have setup a site with parent theme and later realize the need for some customization, you go ahead to build the child theme and after you activate it, you will need to re-do all the settings and options.

I actually opened a ticket for this over a year ago, and now sounds like as good a time as any to get more eyeballs on Konstantin's Obenland's proof of concept patch.

There is also a plugin for importing customizer options from a parent theme, that I think I used once with some success. Hat tip to ManageWP for Puneet's post.

Similar Posts