Make WordPress Core


Ignore:
Timestamp:
02/22/2016 05:30:30 AM (9 years ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-nav-menus.php

    r36586 r36611  
    4848        $this->previewed_menus = array();
    4949        $this->manager         = $manager;
     50
     51        // Skip useless hooks when the user can't manage nav menus anyway.
     52        if ( ! current_user_can( 'edit_theme_options' ) ) {
     53            return;
     54        }
    5055
    5156        add_filter( 'customize_refresh_nonces', array( $this, 'filter_nonces' ) );
Note: See TracChangeset for help on using the changeset viewer.