Make WordPress Core


Ignore:
Timestamp:
11/08/2021 02:26:27 PM (4 years ago)
Author:
youknowriad
Message:

Block Editor: Update the WordPress Packages based on Gutenberg 11.9 RC1.

This brings the JS packages up to date and is the first step that will allow us
to include the other block editor updates for WordPress 5.9:
FSE infrastrucutre, site editor and global styles.

Props noisysocks.
See #54337.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/site-logo.php

    r51421 r52042  
    134134 */
    135135function _delete_site_logo_on_remove_custom_logo( $old_value, $value ) {
     136    global $_ignore_site_logo_changes;
     137
     138    if ( $_ignore_site_logo_changes ) {
     139        return;
     140    }
     141
    136142    // If the custom_logo is being unset, it's being removed from theme mods.
    137143    if ( isset( $old_value['custom_logo'] ) && ! isset( $value['custom_logo'] ) ) {
     
    144150 */
    145151function _delete_site_logo_on_remove_theme_mods() {
     152    global $_ignore_site_logo_changes;
     153
     154    if ( $_ignore_site_logo_changes ) {
     155        return;
     156    }
     157
    146158    if ( false !== get_theme_support( 'custom-logo' ) ) {
    147159        delete_option( 'site_logo' );
     
    161173}
    162174add_action( 'setup_theme', '_delete_site_logo_on_remove_custom_logo_on_setup_theme', 11 );
     175
     176/**
     177 * Removes the custom_logo theme-mod when the site_logo option gets deleted.
     178 */
     179function _delete_custom_logo_on_remove_site_logo() {
     180    global $_ignore_site_logo_changes;
     181
     182    // Prevent _delete_site_logo_on_remove_custom_logo and
     183    // _delete_site_logo_on_remove_theme_mods from firing and causing an
     184    // infinite loop.
     185    $_ignore_site_logo_changes = true;
     186
     187    // Remove the custom logo.
     188    remove_theme_mod( 'custom_logo' );
     189
     190    $_ignore_site_logo_changes = false;
     191}
     192add_action( 'delete_option_site_logo', '_delete_custom_logo_on_remove_site_logo' );
Note: See TracChangeset for help on using the changeset viewer.