Customizer: Fix saving menus with empty names or names that are already used.

Adds validation for initially-supplied nav menu name, blocking empty names from being supplied. If later an empty name is supplied and the nav menu is saved, the name "(unnamed)" will be supplied instead and supplied back to the client. If a name is supplied for the menu which is currently used by another menu, then the name conflict is resolved by adding a numerical counter similar to how `post_name` conflicts are resolved. Includes unit tests.

Fixes #32760.



git-svn-id: https://develop.svn.wordpress.org/trunk@33071 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter
2015-07-03 20:46:48 +00:00
parent 55d7ab3da5
commit a21c6e76d6
5 changed files with 142 additions and 52 deletions
+3 -1
View File
@@ -654,7 +654,9 @@ button.not-a-button {
}
#custom-menu-item-name.invalid,
#custom-menu-item-url.invalid {
#custom-menu-item-url.invalid,
.menu-name-field.invalid,
.menu-name-field.invalid:focus {
border: 1px solid #f00;
}