Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#25258 closed defect (bug) (worksforme)

Notices when no items in nav menu

Reported by: mordauk's profile mordauk Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Menus Keywords: reporter-feedback 2nd-opinion
Focuses: Cc:


When displaying a nav menu with wp_nav_menu() there are a lot of notices if the nav menu is created but has no nav items:

Some sample notices shown in the attached screenshot.

Attachments (2)

Screenshot from 2013-09-08 20:14:13.png (115.2 KB) - added by mordauk 10 years ago.
Screenshot from 2013-09-08 20:15:00.png (38.9 KB) - added by mordauk 10 years ago.
nav menu with no items

Download all attachments as: .zip

Change History (6)

10 years ago

nav menu with no items

#1 @SergeyBiryukov
10 years ago

  • Keywords reporter-feedback added; needs-patch removed

Could not reproduce on a clean install:

  1. If there are no menu items, wp_nav_menu() falls back to wp_page_menu() by default:
  2. If I specify an empty fallback_cb parameter to disable the default fallback, then the walker is called via walk_nav_menu_tree(), but it bails out early if there are no items:

Tested in both 3.6 and current trunk. Could you provide the exact steps to reproduce?

#2 @nofearinc
10 years ago

  • Keywords 2nd-opinion added

Can't reproduce here either, seems like the walker has been called on Pippin's setup and trying to work with empty $item being passed, but I can't replicate that use case either (by using the menu or theme_location arguments for wp_nav_menu).

#3 @nacin
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

#4 @SergeyBiryukov
10 years ago

  • Version changed from trunk to 3.6
Note: See TracTickets for help on using tickets.