Make WordPress Core

Changeset 58376


Ignore:
Timestamp:
06/10/2024 10:10:03 PM (6 weeks ago)
Author:
audrasjb
Message:

Customize: Avoid loading the widgets component if a block theme is activated.

This changeset adds a check to ensure the current theme is not a block theme before adding the widgets component to the Customizer manager. This avoids a PHP warning when previewing/customizing notification emails with a block theme in BuddyPress and potentially on other plugins.

See https://github.com/buddypress/buddypress/pull/215.

Props imath, mukesh27, faisal03, sumitbagthariya16, webcommsat.
Fixes #60236.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r57801 r58376  
    101101     * @var array
    102102     */
    103     protected $components = array( 'widgets', 'nav_menus' );
     103    protected $components = array( 'nav_menus' );
    104104
    105105    /**
     
    285285        if ( ! isset( $args['messenger_channel'] ) && isset( $_REQUEST['customize_messenger_channel'] ) ) {
    286286            $args['messenger_channel'] = sanitize_key( wp_unslash( $_REQUEST['customize_messenger_channel'] ) );
     287        }
     288
     289        // Do not load 'widgets' component if a block theme is activated.
     290        if ( ! wp_is_block_theme() ) {
     291            $this->components[] = 'widgets';
    287292        }
    288293
Note: See TracChangeset for help on using the changeset viewer.