Skip to content

Commit

Permalink
Hook in setup_theme
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Jun 3, 2021
1 parent 86b6f44 commit a1925ff
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/block-library/src/site-logo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,16 @@ function _sync_custom_logo_to_site_logo( $old_value, $value ) {
}
}

add_action( 'update_option_theme_mods_' . get_option( 'stylesheet' ), '_sync_custom_logo_to_site_logo', 10, 2 );
/**
* Hooks `_sync_custom_logo_to_site_logo` in `update_option_theme_mods_$theme`.
*
* Runs on `setup_theme` to account for dynamically-switched themes in the Customizer.
*/
function _sync_custom_logo_to_site_logo_on_setup_theme() {
$theme = get_option( 'stylesheet' );
add_action( "update_option_theme_mods_$theme", '_sync_custom_logo_to_site_logo', 10, 2 );
}
add_action( 'setup_theme', '_sync_custom_logo_to_site_logo_on_setup_theme', 11 );

/**
* Updates the custom_logo theme-mod when the site_logo option gets updated.
Expand Down

0 comments on commit a1925ff

Please sign in to comment.