WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 2 years ago

#14414 accepted feature request

Add an action hook to add fields to nav_menu items form

Reported by: DreadLox Owned by: Gecka
Milestone: Future Release Priority: normal
Severity: normal Version: 3.1
Component: Menus Keywords: has-patch
Focuses: Cc:

Description

Hello,

In order to add a custom field to a nav menu item form, I have to setup a custom walker whereas a simple action hook could do the trick. Everything else is ok to handle and save the custom field. (http://loxdev.knc.nc/blog/wordpress/auto-populate-nav-menu-with-sub-pages/)

Here is how the asked action hook could be added:
http://github.com/loxK/Wordpress_Gecka_Submenu/blob/master/models/NavMenuHacks.php#L310-312

Attachments (1)

nav_menu_custom_fields.patch (644 bytes) - added by Gecka 3 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 wonderslug4 years ago

I think this should really be an alternative to the wp_edit_nav_menu_walker filter, which replaces the walker classname. This filter will cause clashes if multiple plugins change the classname of the walker. Only the last filter run will win.

This action would be a way for multiple plugins to add fields to the menu items (like is done with widget fields right now) and not have conflicts.

comment:2 nacin3 years ago

  • Milestone changed from Awaiting Review to Future Release

comment:3 Gecka3 years ago

  • Keywords has-patch added
  • Owner set to Gecka
  • Status changed from new to accepted
  • Version set to 3.1

comment:4 wlindley2 years ago

Is there any reason this one-line patch cannot be incorporated into 3.3 ...?

comment:5 duck_2 years ago

Closed #18889 as a duplicate. It had ticket18889.patch which suggested a large number of new filters.

Is there any reason this one-line patch cannot be incorporated into 3.3 ...?

Because the time for feature requests / enhancements passed a while ago.

comment:6 ocean902 years ago

  • Milestone changed from Future Release to 3.4

Closed as a duplicate: #20093

Related: #18584

comment:7 nacin2 years ago

  • Milestone changed from 3.4 to Future Release

Since this is part of a walker, those doing big customizations can replace it. We should probably solve issues like nav-menus.php saving quite a bit of data before we open this up too much. Per IRC scrub.

Note: See TracTickets for help on using tickets.