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. Built from https://develop.svn.wordpress.org/trunk@36611 git-svn-id: http://core.svn.wordpress.org/trunk@36578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -48,6 +48,11 @@ final class WP_Customize_Nav_Menus {
|
||||
$this->previewed_menus = array();
|
||||
$this->manager = $manager;
|
||||
|
||||
// Skip useless hooks when the user can't manage nav menus anyway.
|
||||
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter( 'customize_refresh_nonces', array( $this, 'filter_nonces' ) );
|
||||
add_action( 'wp_ajax_load-available-menu-items-customizer', array( $this, 'ajax_load_available_items' ) );
|
||||
add_action( 'wp_ajax_search-available-menu-items-customizer', array( $this, 'ajax_search_available_items' ) );
|
||||
|
||||
Reference in New Issue
Block a user