mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 07:07:04 +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:
@@ -98,27 +98,4 @@ class WP_Customize_Nav_Menus_Panel extends WP_Customize_Panel {
|
||||
<li class="customize-control-title customize-section-title-nav_menus-heading"><?php _e( 'Menus' ); ?></li>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks required user capabilities and whether the theme has the
|
||||
* feature support required by the panel.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return bool False if theme doesn't support the panel or the user doesn't have the capability.
|
||||
*/
|
||||
public function check_capabilities() {
|
||||
/*
|
||||
* WP_Customize_Panel::$theme_supports only supports checking one
|
||||
* theme_supports, so instead we override check_capabilities().
|
||||
*/
|
||||
if (
|
||||
! current_theme_supports( 'menus' ) &&
|
||||
! current_theme_supports( 'widgets' )
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::check_capabilities();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user