Skip to content

Instantly share code, notes, and snippets.

@skorasaurus
Last active November 7, 2019 18:58
Show Gist options
  • Select an option

  • Save skorasaurus/6231a717c89c69cb98f82abc2abf1583 to your computer and use it in GitHub Desktop.

Select an option

Save skorasaurus/6231a717c89c69cb98f82abc2abf1583 to your computer and use it in GitHub Desktop.
this is 7.0 ok.
// make child theme inherit all of Tempera's external WP options (header/bg/menus/widgets)
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 );
} );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment