[wp-trac] [WordPress Trac] #58183: PHP notice when accessing Customizer with a classic theme without widgets
WordPress Trac
noreply at wordpress.org
Tue Apr 25 00:09:35 UTC 2023
#58183: PHP notice when accessing Customizer with a classic theme without widgets
--------------------------+------------------------------
Reporter: kraftner | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by westonruter):
Looking at this briefly, I can see that the Widgets panel is being
[https://github.com/WordPress/wordpress-
develop/blob/26e3948fca904db17a588d3736b3db59f8007daa/src/wp-includes
/class-wp-customize-widgets.php#L415-L426 registered] with an
`active_callback` set to `WP_Customize_Widgets::is_panel_active()`, which
is [https://github.com/WordPress/wordpress-
develop/blob/26e3948fca904db17a588d3736b3db59f8007daa/src/wp-includes
/class-wp-customize-widgets.php#L549-L562 defined] as:
{{{#!php
<?php
public function is_panel_active() {
global $wp_registered_sidebars;
return ! empty( $wp_registered_sidebars );
}
}}}
This is different to how the Menus panel was being registered
conditionally, in that instead of an `active` callback the
`WP_Customize_Nav_Menus::check_capabilities()` method was utilized prior
to [54419]. When `check_capabilities` is used, it will actually cause the
panel to be [https://github.com/WordPress/wordpress-
develop/blob/26e3948fca904db17a588d3736b3db59f8007daa/src/wp-includes
/class-wp-customize-manager.php#L4488-L4516 removed entirely] in
`WP_Customize_Manager::prepare_controls()` runs. This is why, as I recall,
the notice was happening for menus, because the Panel got removed.
I remain unsure why this is happening for Widgets since
`check_capbilities` is not being used, but rather the `active_callback`.
So the panel shouldn't be getting removed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58183#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list