Skip to content

Instantly share code, notes, and snippets.

@Steeru
Created April 3, 2018 11:07
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 Steeru/84d0521f5b8aded2d53e8b1eb4938bf3 to your computer and use it in GitHub Desktop.
Save Steeru/84d0521f5b8aded2d53e8b1eb4938bf3 to your computer and use it in GitHub Desktop.
function travel_log_child_update_option_vals( $value, $old_value ) {
update_option( 'theme_mods_' . get_template(), $value );
return $old_value; // prevent update to child theme mods
}
function travel_log_child_customizer_default_vals_update( $default ) {
return get_option( 'theme_mods_' . get_template(), $default );
}
function travel_log_child_customizer_parent_options_import() {
if ( get_stylesheet() !== get_template() ) {
add_filter( 'pre_update_option_theme_mods_' . get_stylesheet(), 'travel_log_child_update_option_vals', 10, 2 );
add_filter( 'pre_option_theme_mods_' . get_stylesheet(), 'travel_log_child_customizer_default_vals_update' );
}
}
add_action('init', 'travel_log_child_customizer_parent_options_import');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment