Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#14527 closed defect (bug) (fixed)

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

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

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 14 years ago.
Patch
14527.patch (685 bytes) - added by ocean90 13 years ago.
Check if class exists
14527.2.patch (1.2 KB) - added by ocean90 13 years ago.

Download all attachments as: .zip

Change History (9)

#1 @nacin
14 years ago

  • Keywords has-patch 3.2-early commit added; nav_menu walker removed
  • Milestone changed from Awaiting Review to Future Release

#2 @ocean90
13 years ago

  • Component changed from Administration to Menus
  • Keywords 3.2-early removed
  • Milestone changed from Future Release to 3.4

I just run into this issue.

@ocean90
13 years ago

Check if class exists

#3 @nacin
13 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
13 years ago

  • Keywords needs-refresh added

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

@ocean90
13 years ago

#5 @ocean90
13 years ago

  • Keywords needs-refresh removed

#6 @nacin
13 years ago

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

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.