Make WordPress Core

Opened 6 months ago

Closed 6 weeks ago

Last modified 6 weeks ago

#60236 closed defect (bug) (fixed)

Customizer’s Widget's component should only be loaded when not using a Block Theme

Reported by: imath's profile imath Owned by: audrasjb's profile audrasjb
Milestone: 6.6 Priority: normal
Severity: normal Version: 5.9
Component: Customize Keywords: has-patch has-screenshots commit
Focuses: Cc:



The BuddyPress plugin has a feature to customize the notification emails it sends when users interact. This feature uses the Customizer from the WP Admin context only.

When the current theme is a Block Theme, previewing/customizing notification emails is generating this Warning notice:
PHP Warning: Attempt to read property "title" on null in /path/to/wordpress.develop/build/wp-includes/class-wp-customize-widgets.php on line 905

After some search into the WP_Customize_Manager class I noticed, although these kind of themes do not use the widgets component all corresponding Customizer controllers were loaded although this was not necessary.

Disabling the Customizer widgets component using the 'customize_loaded_components' filter removed this Warning notice, so I could use this from BuddyPress when these kind of themes are active on sites.

But I believe WordPress should only make the Customizer's widgets component available when the active theme is not a Block theme as BuddyPress might not be the only plugin to use the Customizer even if a Block theme is the active one.

Change History (8)

This ticket was mentioned in PR #5861 on WordPress/wordpress-develop by @imath.

6 months ago

  • Keywords has-patch added

Check the current theme is not a block one before adding the widgets component to the Customizer manager.


Trac ticket:

#2 @swissspidy
5 months ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to 6.6
  • Version changed from trunk to 5.9

#3 @faisal03
8 weeks ago

Test Report

I tested the patch, and it is working as expected. ✅




  • OS: macOS
  • Localhost Server: Nginx
  • PHP: 8.2.1
  • WordPress: 6.5.3
  • Browser: Chrome
  • Theme: TT3

Actual Results

  • ✅ The patch is working fine and now the PHP notice is gone.

#4 @sumitbagthariya16
7 weeks ago

Test Report ✅

I tested the patch, and it is working as expected.


WordPress: 6.5.3
Theme: Twenty Twenty-Three 1.4
PHP: 8.0.30
Web Server: Nginx 1.20.2
Browser: Chrome
OS: macOS Ventura 13.3

Actual Result

The patch is working fine, no more PHP notices.

#5 @webcommsat
7 weeks ago

Tested this patch with a colleague, and no PHP notices received in either test.

OS: Mac OS
Localhost Server: Nginx 1.25
PHP: 8.2
WordPress: 6.5.3
Browser: Chrome
Theme: Twenty-twenty three

#6 @audrasjb
6 weeks ago

  • Keywords has-screenshots commit added; needs-testing removed
  • Owner set to audrasjb
  • Status changed from new to accepted

Self assigning for commit.

#7 @audrasjb
6 weeks ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 58376:

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.


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

Note: See TracTickets for help on using tickets.