WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#23806 new enhancement

Nav Menu Edit Walker per menu item type, not menu?

Reported by: GaryJ Owned by:
Priority: normal Milestone: Awaiting Review
Component: Menus Version:
Severity: normal Keywords: needs-patch
Cc:

Description

The assignment of a walker to show the menu items on the right side of the Menus screen is set per menu in wp_get_nav_menu_to_edit().

Ideally, it could be overridden per menu item type. That is, posttype, custom and taxonomy menu items can be handled by Walker_Nav_Menu_Edit, while a menu item (in the same menu) or 'foobar' can be handled by the start_el() from a different walker.

As things stand, I'd have to extend Walker_Nav_Menu_Edit, copy start_el(), and place the conditional code for what to output in there (in my case, strip out fields that aren't ever going to be used in my 'foobar' menu item type).

Change History (3)

comment:1 GaryJ3 months ago

  • Type changed from defect (bug) to enhancement

comment:2 GaryJ3 months ago

Alternatively, Walker_Nav_Menu_Edit::start_el() needs to have a filter before or around the existing markup, which passes through the $item including menu item type, so it can be replaced with something custom.

Note: See TracTickets for help on using tickets.