Customizer: Update nav_menu_locations[...] controls to remove placeholder menus from the dropdown options upon Save & Publish.

See #32814.
Fixes #33176.


git-svn-id: https://develop.svn.wordpress.org/trunk@33496 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter
2015-07-29 19:33:07 +00:00
parent 37aa0574c4
commit 05c32013d7

View File

@@ -2492,7 +2492,7 @@
oldSection.container.remove();
api.section.remove( oldCustomizeId );
// Remove the menu to the nav menu widget template.
// Update the nav_menu widget to reflect removed placeholder menu.
navMenuCount = 0;
api.each(function( setting ) {
if ( /^nav_menu\[/.test( setting.id ) && false !== setting() ) {
@@ -2504,6 +2504,13 @@
widgetTemplate.find( '.nav-menu-widget-no-menus-message:first' ).toggle( 0 === navMenuCount );
widgetTemplate.find( 'option[value=' + String( update.previous_term_id ) + ']' ).remove();
// Update the nav_menu_locations[...] controls to remove the placeholder menus from the dropdown options.
wp.customize.control.each(function( control ){
if ( /^nav_menu_locations\[/.test( control.id ) ) {
control.container.find( 'option[value=' + String( update.previous_term_id ) + ']' ).remove();
}
});
// Update nav_menu_locations to reference the new ID.
api.each( function( setting ) {
var wasSaved = api.state( 'saved' ).get();