Customize: Fix inability to delete nav menus by preventing `preview` filters from being added during `customize_save` admin ajax request.
Also prevent setting `nav_menu_locations[...]` values to `NaN` which gets sent as `null`. Amends [38810]. See #30937. Fixes #39103. Built from https://develop.svn.wordpress.org/trunk@39558 git-svn-id: http://core.svn.wordpress.org/trunk@39498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f1c383454b
commit
1b96e389c0
|
@ -1177,7 +1177,11 @@
|
|||
|
||||
// @todo It would be better if this was added directly on the setting itself, as opposed to the control.
|
||||
control.setting.validate = function( value ) {
|
||||
return parseInt( value, 10 );
|
||||
if ( '' === value ) {
|
||||
return 0;
|
||||
} else {
|
||||
return parseInt( value, 10 );
|
||||
}
|
||||
};
|
||||
|
||||
// Edit menu button.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -531,10 +531,7 @@ final class WP_Customize_Nav_Menus {
|
|||
*/
|
||||
public function customize_register() {
|
||||
|
||||
/*
|
||||
* Preview settings for nav menus early so that the sections and controls will be added properly.
|
||||
* See https://github.com/xwp/wp-customize-snapshots/blob/962586659688a5b1fd9ae93618b7ce2d4e7a421c/php/class-customize-snapshot-manager.php#L506-L543
|
||||
*/
|
||||
// Preview settings for nav menus early so that the sections and controls will be added properly.
|
||||
$nav_menus_setting_ids = array();
|
||||
foreach ( array_keys( $this->manager->unsanitized_post_values() ) as $setting_id ) {
|
||||
if ( preg_match( '/^(nav_menu_locations|nav_menu|nav_menu_item)\[/', $setting_id ) ) {
|
||||
|
@ -542,10 +539,12 @@ final class WP_Customize_Nav_Menus {
|
|||
}
|
||||
}
|
||||
$this->manager->add_dynamic_settings( $nav_menus_setting_ids );
|
||||
foreach ( $nav_menus_setting_ids as $setting_id ) {
|
||||
$setting = $this->manager->get_setting( $setting_id );
|
||||
if ( $setting ) {
|
||||
$setting->preview();
|
||||
if ( ! $this->manager->doing_ajax( 'customize_save' ) ) {
|
||||
foreach ( $nav_menus_setting_ids as $setting_id ) {
|
||||
$setting = $this->manager->get_setting( $setting_id );
|
||||
if ( $setting ) {
|
||||
$setting->preview();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8-alpha-39557';
|
||||
$wp_version = '4.8-alpha-39558';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue