Created
January 17, 2018 12:27
-
-
Save anonymous/d48b112faa0b83d9d2c7dbb02e08013e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nature_bliss_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', 'nature_bliss_pro_child_customizer_options_import'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment