diff --git src/wp-includes/class-wp-customize-control.php src/wp-includes/class-wp-customize-control.php
index a892b10..c53422e 100644
|
|
class WP_Customize_Control { |
187 | 187 | $this->instance_number = self::$instance_count; |
188 | 188 | |
189 | 189 | // Process settings. |
190 | | if ( empty( $this->settings ) ) { |
| 190 | if ( ! isset( $args['settings'] ) ) { |
191 | 191 | $this->settings = $id; |
192 | 192 | } |
193 | 193 | |
… |
… |
class WP_Customize_Control { |
196 | 196 | foreach ( $this->settings as $key => $setting ) { |
197 | 197 | $settings[ $key ] = $this->manager->get_setting( $setting ); |
198 | 198 | } |
199 | | } else { |
| 199 | } else if ( is_string( $this->settings ) ) { |
200 | 200 | $this->setting = $this->manager->get_setting( $this->settings ); |
201 | 201 | $settings['default'] = $this->setting; |
202 | 202 | } |
diff --git src/wp-includes/class-wp-customize-nav-menus.php src/wp-includes/class-wp-customize-nav-menus.php
index b4bd0fd..77593d9 100644
|
|
final class WP_Customize_Nav_Menus { |
596 | 596 | 'priority' => 999, |
597 | 597 | ) ) ); |
598 | 598 | |
599 | | $this->manager->add_setting( 'new_menu_name', array( |
600 | | 'type' => 'new_menu', |
601 | | 'default' => '', |
602 | | 'transport' => isset( $this->manager->selective_refresh ) ? 'postMessage' : 'refresh', |
603 | | ) ); |
604 | | |
605 | 599 | $this->manager->add_control( 'new_menu_name', array( |
606 | 600 | 'label' => '', |
607 | 601 | 'section' => 'add_menu', |
… |
… |
final class WP_Customize_Nav_Menus { |
612 | 606 | ), |
613 | 607 | ) ); |
614 | 608 | |
615 | | $this->manager->add_setting( 'create_new_menu', array( |
616 | | 'type' => 'new_menu', |
617 | | ) ); |
618 | | |
619 | 609 | $this->manager->add_control( new WP_Customize_New_Menu_Control( $this->manager, 'create_new_menu', array( |
620 | 610 | 'section' => 'add_menu', |
621 | 611 | ) ) ); |
diff --git src/wp-includes/customize/class-wp-customize-partial.php src/wp-includes/customize/class-wp-customize-partial.php
index 3cb410b..680c5f0 100644
|
|
class WP_Customize_Partial { |
90 | 90 | public $primary_setting; |
91 | 91 | |
92 | 92 | /** |
| 93 | * Capability required to edit this partial. |
| 94 | * |
| 95 | * Normally this is empty and the capability is derived from the capabilities |
| 96 | * of the associated `$settings`. |
| 97 | * |
| 98 | * @since 4.5.0 |
| 99 | * @access public |
| 100 | * @var string |
| 101 | */ |
| 102 | public $capability; |
| 103 | |
| 104 | /** |
93 | 105 | * Render callback. |
94 | 106 | * |
95 | 107 | * @since 4.5.0 |
… |
… |
class WP_Customize_Partial { |
157 | 169 | } |
158 | 170 | |
159 | 171 | // Process settings. |
160 | | if ( empty( $this->settings ) ) { |
| 172 | if ( ! isset( $args['settings'] ) ) { |
161 | 173 | $this->settings = array( $id ); |
162 | 174 | } else if ( is_string( $this->settings ) ) { |
163 | 175 | $this->settings = array( $this->settings ); |
… |
… |
class WP_Customize_Partial { |
290 | 302 | * Checks if the user can refresh this partial. |
291 | 303 | * |
292 | 304 | * Returns false if the user cannot manipulate one of the associated settings, |
293 | | * or if one of the associated settings does not exist. |
| 305 | * or if one of the associated settings does not exist, or if the partial |
| 306 | * has an explicit `$capability` which the current user cannot do. |
294 | 307 | * |
295 | 308 | * @since 4.5.0 |
296 | 309 | * @access public |
… |
… |
class WP_Customize_Partial { |
299 | 312 | * or if one of the associated settings does not exist. |
300 | 313 | */ |
301 | 314 | final public function check_capabilities() { |
| 315 | if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) { |
| 316 | return false; |
| 317 | } |
302 | 318 | foreach ( $this->settings as $setting_id ) { |
303 | 319 | $setting = $this->component->manager->get_setting( $setting_id ); |
304 | 320 | if ( ! $setting || ! $setting->check_capabilities() ) { |