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.



Built from https://develop.svn.wordpress.org/trunk@58376


git-svn-id: http://core.svn.wordpress.org/trunk@57825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2024-06-10 22:12:17 +00:00
parent 5a9b7f8c62
commit ea70d42705
2 changed files with 7 additions and 2 deletions

View File

@ -100,7 +100,7 @@ final class WP_Customize_Manager {
* @since 4.5.0 * @since 4.5.0
* @var array * @var array
*/ */
protected $components = array( 'widgets', 'nav_menus' ); protected $components = array( 'nav_menus' );
/** /**
* Registered instances of WP_Customize_Section. * Registered instances of WP_Customize_Section.
@ -286,6 +286,11 @@ final class WP_Customize_Manager {
$args['messenger_channel'] = sanitize_key( wp_unslash( $_REQUEST['customize_messenger_channel'] ) ); $args['messenger_channel'] = sanitize_key( wp_unslash( $_REQUEST['customize_messenger_channel'] ) );
} }
// Do not load 'widgets' component if a block theme is activated.
if ( ! wp_is_block_theme() ) {
$this->components[] = 'widgets';
}
$this->original_stylesheet = get_stylesheet(); $this->original_stylesheet = get_stylesheet();
$this->theme = wp_get_theme( 0 === validate_file( $args['theme'] ) ? $args['theme'] : null ); $this->theme = wp_get_theme( 0 === validate_file( $args['theme'] ) ? $args['theme'] : null );
$this->messenger_channel = $args['messenger_channel']; $this->messenger_channel = $args['messenger_channel'];

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.6-beta1-58375'; $wp_version = '6.6-beta1-58376';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.