Make WordPress Core

Opened 16 years ago

Closed 14 years ago

#14527 closed defect (bug) (fixed)

ajax call for add-menu-item doesnt supprot wp_edit_nav_menu_walker filter

Reported by: wonderslug Owned by: nacin
Priority: normal Milestone: 3.4
Component: Menus Version: 3.0.1
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description

The wp_get_nav_menu_to_edit function (wp-admin/includes/nav-menu.php) supports a filter on the wp_edit_nav_menu_walker in order for plugins to pass a different walker class to the menu item admin.

The ajax call (add-menu-item) supporting the creation of a new menu-item that uses this same walker is not supporting the filter.

In order to make it so that both and and existing menu items support are calling the same walker to get the html for menu items this filter need to be added to the ajax.

I am attaching a patch that works.

Attachments (3)

walker_nav_menu_edit-ajax.patch (619 bytes ) - added by wonderslug 16 years ago.
Patch
14527.patch (685 bytes ) - added by ocean90 15 years ago.
Check if class exists
14527.2.patch (1.2 KB ) - added by ocean90 14 years ago.

Download all attachments as: .zip

Change History (9)

#1 @nacin
16 years ago

  • Keywords has-patch 3.2-early commit added; nav_menu walker removed
  • Milestone Awaiting ReviewFuture Release

#2 @ocean90
15 years ago

  • Component AdministrationMenus
  • Keywords 3.2-early removed
  • Milestone Future Release3.4

I just run into this issue.

@ocean90
15 years ago

Check if class exists

#3 @nacin
15 years ago

-1 implies a permissions issue, 0 is generally used for failures. (Does the code that triggers this ajax know to look for -1/0?)

Normally, we'd probably avoid the class_exists() (and show devs their error), since this is already in a released version, it makes sense to avoid the errors.

A few plugins use the wp_edit_nav_menu_walker filter. How many of them don't load the class they want via Ajax?

./plugins/gantry/widgets/menu.php:51:            add_filter('wp_edit_nav_menu_walker', array("GantryWidgetMenu", "setupWalker"), 1000, 2);
./plugins/gecka-submenu/models/NavMenuHacks.php:10:            add_filter( 'wp_edit_nav_menu_walker', array($this, 'custom_walker') );
./plugins/menu-items-visibility-control/menu-items-visibility.php:26:	add_filter( 'wp_edit_nav_menu_walker', 'boom_nav_menu_edit_custom_walker' );

#4 @nacin
14 years ago

  • Keywords needs-refresh added

Let's get this in as is. Needs refresh.

@ocean90
14 years ago

#5 @ocean90
14 years ago

  • Keywords needs-refresh removed

#6 @nacin
14 years ago

  • Owner set to nacin
  • Resolutionfixed
  • Status newclosed

In [20072]:

Add the wp_edit_nav_menu_walker filter to the ajax request. props wonderslug, ocean90. fixes #14527.

Note: See TracTickets for help on using tickets.