| 1 | diff --git src/wp-admin/js/customize-nav-menus.js src/wp-admin/js/customize-nav-menus.js |
|---|
| 2 | index b7556f6..a37d2c4 100644 |
|---|
| 3 | --- src/wp-admin/js/customize-nav-menus.js |
|---|
| 4 | +++ src/wp-admin/js/customize-nav-menus.js |
|---|
| 5 | @@ -1169,7 +1169,11 @@ |
|---|
| 6 | |
|---|
| 7 | // @todo It would be better if this was added directly on the setting itself, as opposed to the control. |
|---|
| 8 | control.setting.validate = function( value ) { |
|---|
| 9 | - return parseInt( value, 10 ); |
|---|
| 10 | + if ( '' === value ) { |
|---|
| 11 | + return 0; |
|---|
| 12 | + } else { |
|---|
| 13 | + return parseInt( value, 10 ); |
|---|
| 14 | + } |
|---|
| 15 | }; |
|---|
| 16 | |
|---|
| 17 | // Edit menu button. |
|---|
| 18 | diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php |
|---|
| 19 | index 127d572..2bb291f 100644 |
|---|
| 20 | --- src/wp-includes/class-wp-customize-manager.php |
|---|
| 21 | +++ src/wp-includes/class-wp-customize-manager.php |
|---|
| 22 | @@ -227,6 +227,13 @@ final class WP_Customize_Manager { |
|---|
| 23 | private $_changeset_data; |
|---|
| 24 | |
|---|
| 25 | /** |
|---|
| 26 | + * Whether the instance will only be used for saving, and not previewing. |
|---|
| 27 | + * |
|---|
| 28 | + * @var |
|---|
| 29 | + */ |
|---|
| 30 | + public $saving = false; |
|---|
| 31 | + |
|---|
| 32 | + /** |
|---|
| 33 | * Constructor. |
|---|
| 34 | * |
|---|
| 35 | * @since 3.4.0 |
|---|
| 36 | @@ -243,7 +250,7 @@ final class WP_Customize_Manager { |
|---|
| 37 | public function __construct( $args = array() ) { |
|---|
| 38 | |
|---|
| 39 | $args = array_merge( |
|---|
| 40 | - array_fill_keys( array( 'changeset_uuid', 'theme', 'messenger_channel' ), null ), |
|---|
| 41 | + array_fill_keys( array( 'changeset_uuid', 'theme', 'messenger_channel', 'saving' ), null ), |
|---|
| 42 | $args |
|---|
| 43 | ); |
|---|
| 44 | |
|---|
| 45 | @@ -268,6 +275,7 @@ final class WP_Customize_Manager { |
|---|
| 46 | $this->theme = wp_get_theme( $args['theme'] ); |
|---|
| 47 | $this->messenger_channel = $args['messenger_channel']; |
|---|
| 48 | $this->_changeset_uuid = $args['changeset_uuid']; |
|---|
| 49 | + $this->saving = ! empty( $args['saving'] ) || $this->doing_ajax( 'customize_save' ); |
|---|
| 50 | |
|---|
| 51 | require_once( ABSPATH . WPINC . '/class-wp-customize-setting.php' ); |
|---|
| 52 | require_once( ABSPATH . WPINC . '/class-wp-customize-panel.php' ); |
|---|
| 53 | @@ -741,7 +749,7 @@ final class WP_Customize_Manager { |
|---|
| 54 | * may short-circuit because it will detect that there are no changes to |
|---|
| 55 | * make. |
|---|
| 56 | */ |
|---|
| 57 | - if ( ! $this->doing_ajax( 'customize_save' ) ) { |
|---|
| 58 | + if ( ! $this->saving ) { |
|---|
| 59 | foreach ( $this->settings as $setting ) { |
|---|
| 60 | $setting->preview(); |
|---|
| 61 | } |
|---|
| 62 | diff --git src/wp-includes/class-wp-customize-nav-menus.php src/wp-includes/class-wp-customize-nav-menus.php |
|---|
| 63 | index ca1b72f..1bffeb0 100644 |
|---|
| 64 | --- src/wp-includes/class-wp-customize-nav-menus.php |
|---|
| 65 | +++ src/wp-includes/class-wp-customize-nav-menus.php |
|---|
| 66 | @@ -542,10 +542,12 @@ final class WP_Customize_Nav_Menus { |
|---|
| 67 | } |
|---|
| 68 | } |
|---|
| 69 | $this->manager->add_dynamic_settings( $nav_menus_setting_ids ); |
|---|
| 70 | - foreach ( $nav_menus_setting_ids as $setting_id ) { |
|---|
| 71 | - $setting = $this->manager->get_setting( $setting_id ); |
|---|
| 72 | - if ( $setting ) { |
|---|
| 73 | - $setting->preview(); |
|---|
| 74 | + if ( ! $this->manager->saving ) { |
|---|
| 75 | + foreach ( $nav_menus_setting_ids as $setting_id ) { |
|---|
| 76 | + $setting = $this->manager->get_setting( $setting_id ); |
|---|
| 77 | + if ( $setting ) { |
|---|
| 78 | + $setting->preview(); |
|---|
| 79 | + } |
|---|
| 80 | } |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | diff --git src/wp-includes/class-wp-customize-widgets.php src/wp-includes/class-wp-customize-widgets.php |
|---|
| 84 | index 7403119..7fa38e6 100644 |
|---|
| 85 | --- src/wp-includes/class-wp-customize-widgets.php |
|---|
| 86 | +++ src/wp-includes/class-wp-customize-widgets.php |
|---|
| 87 | @@ -209,10 +209,10 @@ final class WP_Customize_Widgets { |
|---|
| 88 | |
|---|
| 89 | /* |
|---|
| 90 | * Preview settings right away so that widgets and sidebars will get registered properly. |
|---|
| 91 | - * But don't do this if a customize_save because this will cause WP to think there is nothing |
|---|
| 92 | - * changed that needs to be saved. |
|---|
| 93 | + * But don't do this when saving the changeset because this will cause WP to think there |
|---|
| 94 | + * is nothing changed that needs to be saved. |
|---|
| 95 | */ |
|---|
| 96 | - if ( ! $this->manager->doing_ajax( 'customize_save' ) ) { |
|---|
| 97 | + if ( ! $this->manager->saving ) { |
|---|
| 98 | foreach ( $settings as $setting ) { |
|---|
| 99 | $setting->preview(); |
|---|
| 100 | } |
|---|
| 101 | @@ -509,7 +509,7 @@ final class WP_Customize_Widgets { |
|---|
| 102 | } |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | - if ( ! $this->manager->doing_ajax( 'customize_save' ) ) { |
|---|
| 106 | + if ( ! $this->manager->saving ) { |
|---|
| 107 | foreach ( $new_setting_ids as $new_setting_id ) { |
|---|
| 108 | $this->manager->get_setting( $new_setting_id )->preview(); |
|---|
| 109 | } |
|---|