Make WordPress Core


Ignore:
Timestamp:
02/22/2016 05:30:30 AM (10 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-widgets.php

    r36586 r36611  
    8484    public function __construct( $manager ) {
    8585        $this->manager = $manager;
     86
     87        // Skip useless hooks when the user can't manage widgets anyway.
     88        if ( ! current_user_can( 'edit_theme_options' ) ) {
     89            return;
     90        }
    8691
    8792        add_filter( 'customize_dynamic_setting_args',          array( $this, 'filter_customize_dynamic_setting_args' ), 10, 2 );
Note: See TracChangeset for help on using the changeset viewer.