mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 04:04:35 +00:00
Customize: Prevent PHP notice in Customizer when using block theme.
Use the `customize_panel_active` filter to deactivate the Menus panel instead of overriding the `check_capabilities` method. This ensures the panel remains registered but is still hidden. See #54888. Fixes #54905. git-svn-id: https://develop.svn.wordpress.org/trunk@54419 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -4257,4 +4257,23 @@ function _add_default_theme_supports() {
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
|
||||
add_filter( 'should_load_separate_core_block_assets', '__return_true' );
|
||||
|
||||
/*
|
||||
* Remove the Customizer's Menus panel when block theme is active.
|
||||
*/
|
||||
add_filter(
|
||||
'customize_panel_active',
|
||||
static function ( $active, WP_Customize_Panel $panel ) {
|
||||
if (
|
||||
'nav_menus' === $panel->id &&
|
||||
! current_theme_supports( 'menus' ) &&
|
||||
! current_theme_supports( 'widgets' )
|
||||
) {
|
||||
$active = false;
|
||||
}
|
||||
return $active;
|
||||
},
|
||||
10,
|
||||
2
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user