WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 8 weeks ago

#25200 new enhancement

Cannot filter Walker items in Walker_Nav_Menu_Checklist class

Reported by: maxaud Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.6
Component: Menus Keywords:
Focuses: administration Cc:

Description

I have a need to filter the URL of a menu item in the nav-menus.php admin page.

The Walker_Nav_Menu class uses the following code to filter the attributes which would be great but..

$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );

.. the Walker_Nav_Menu_Checklist class that generates a checklist doesn't filter the links attributes like the Walker_Nav_Menu class.

Change History (2)

comment:1 ericlewis8 weeks ago

  • Focuses administration added
  • Keywords reporter-feedback added
  • Type changed from defect (bug) to enhancement

@maxaud, can you provide more detail on what you're trying to do?

Walker_Nav_Menu_Checklist generates the checklists within the accordion sections in nav-menus.php (Pages, Links, Categories etc.). It does not generate a link for each nav item. I think you might be confusing one class with another.

comment:2 maxaud8 weeks ago

  • Keywords reporter-feedback removed

I needed to modify the URL associated with the checklist item.

Here is some coded generated by the item (see: "[menu-item-url]"):

<li>
	<label class="menu-item-title"><input type="checkbox" class="menu-item-checkbox" name="menu-item[-2][menu-item-object-id]" value="15706">Some Page Item</label>
	<input type="hidden" class="menu-item-db-id" name="menu-item[-2][menu-item-db-id]" value="0">
	<input type="hidden" class="menu-item-object" name="menu-item[-2][menu-item-object]" value="page">
	<input type="hidden" class="menu-item-parent-id" name="menu-item[-2][menu-item-parent-id]" value="0">
	<input type="hidden" class="menu-item-type" name="menu-item[-2][menu-item-type]" value="post_type">
	<input type="hidden" class="menu-item-title" name="menu-item[-2][menu-item-title]" value="Some Page Item">
	<input type="hidden" class="menu-item-url" name="menu-item[-2][menu-item-url]" value="http://domain.com/some-wordpress-url/">
	<input type="hidden" class="menu-item-target" name="menu-item[-2][menu-item-target]" value="">
	<input type="hidden" class="menu-item-attr_title" name="menu-item[-2][menu-item-attr_title]" value="">
	<input type="hidden" class="menu-item-classes" name="menu-item[-2][menu-item-classes]" value="">
	<input type="hidden" class="menu-item-xfn" name="menu-item[-2][menu-item-xfn]" value="">
</li>
Note: See TracTickets for help on using tickets.