Skip to content

Instantly share code, notes, and snippets.

Created December 11, 2017 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8b08638a312b5d18e9e07eecc89b2b05 to your computer and use it in GitHub Desktop.
Save anonymous/8b08638a312b5d18e9e07eecc89b2b05 to your computer and use it in GitHub Desktop.
function magazine_plus_pro_child_customizer_options_import() {
if ( get_stylesheet() !== get_template() ) {
add_filter( 'pre_update_option_theme_mods_' . get_stylesheet(), function ( $value, $old_value ) {
update_option( 'theme_mods_' . get_template(), $value );
return $old_value; // prevent update to child theme mods
}, 10, 2 );
add_filter( 'pre_option_theme_mods_' . get_stylesheet(), function ( $default ) {
return get_option( 'theme_mods_' . get_template(), $default );
} );
}
}
add_action('init', 'magazine_plus_pro_child_customizer_options_import');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment