Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#13787 closed defect (bug) (fixed)

Adding an empty menu object displays theme default menu instead

Reported by: markel Owned by:
Milestone: 3.0.1 Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords: has-patch commit
Focuses: Cc:


Tested in r15172:

A user can add a menu object without assigning any items to that menu (which appears to be a "blank" or "empty" menu). This empty menu can then be successfully assigned to one of the menu slots for a theme.

When viewing the site, instead of being empty, the default menu for the theme appears.

Users should either be able to assign an empty menu, in which case no items will appear, or not be able to assign a menu without items to one of the theme slots.

Attachments (1)

13787.diff (920 bytes) - added by ryan 8 years ago.

Download all attachments as: .zip

Change History (9)

#1 @nacin
8 years ago

  • Milestone changed from Unassigned to 3.0

I believe we treat an empty menu the same as a menu that doesn't exist. Worse, we don't abide by it in menu locations (you can assign literally no menu to a location, and it will work). The simple solution I think is that an empty menu should be a valid menu.

#2 @ryan
8 years ago

An empty menu should still be ignored if it isn't assigned to a location. But an empty menu assigned to a location should be respected as deliberate.

8 years ago

#3 @ryan
8 years ago

This should allow for the following:

  • If no location is set, use the fallback.
  • If location is set to an empty menu, use the empty menu.
  • If no menus exist, use the fallback.
  • If location is somehow set to a non-existent menu, use the fallback.

#4 @nacin
8 years ago

  • Keywords has-patch commit added

Fine with that.

#5 @ryan
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [15184]) Allow assigning an empty menu to a location. fixes #13787

#6 follow-up: @RanYanivHartstein
7 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This can create confusion when users accidentally create a new menu, or create a new menu and have it activated as their default menu by default.

I opened a ticket about this on the Themes trac, but it probably belongs here. See my notes on this issue there:


When you create a new menu, it automatically becomes active as the default menu. This may be theme specific, but I checked this again with twentyten and Bueno on a new blog before posting this reply just to be sure. I believe this is the primary cause for "my menu disappeared" tickets, which are quite numerous. I may be missing something here, but I can't see what.

If removing the automatic menu generated by the theme is indeed a desired outcome (I believe it is), there should be a real option to do it. This option should be easily discoverable in a place a user is likely to look in, and it's functionality should be easily understandable so a user won't have to look in forums or help files to understand what it does. Right now, neither is true, and that's why I don't this is something we should expect users to figure out on their own.

#7 in reply to: ↑ 6 @lancewillett
7 years ago

Replying to RanYanivHartstein:

This can create confusion when users accidentally create a new menu, or create a new menu and have it activated as their default menu by default.

Looks like this was fixed in [15429]. @nacin?

#8 @nacin
7 years ago

  • Milestone changed from 3.0 to 3.0.1
  • Resolution set to fixed
  • Status changed from reopened to closed

Yep. Forgot about this ticket; [15430] and [15429] came up independently.

Thanks Lance!

Note: See TracTickets for help on using tickets.