mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Customize: Prevent PHP notice and JS error caused by widgets and nav menus components if user only has customize capability.
Short-circuits components from initializing their hooks needlessly if current user lacks required capability. Fixes #35895. git-svn-id: https://develop.svn.wordpress.org/trunk@36611 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -84,6 +84,11 @@ final class WP_Customize_Widgets {
|
||||
public function __construct( $manager ) {
|
||||
$this->manager = $manager;
|
||||
|
||||
// Skip useless hooks when the user can't manage widgets anyway.
|
||||
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter( 'customize_dynamic_setting_args', array( $this, 'filter_customize_dynamic_setting_args' ), 10, 2 );
|
||||
add_action( 'after_setup_theme', array( $this, 'register_settings' ) );
|
||||
add_action( 'wp_loaded', array( $this, 'override_sidebars_widgets_for_theme_switch' ) );
|
||||
|
||||
Reference in New Issue
Block a user