Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#33447 closed enhancement (fixed)

Introduce a nav menu title filter

Reported by: paulwilde's profile paulwilde Owned by: johnbillion's profile johnbillion
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords: has-patch
Focuses: Cc:


Currently the only way to filter the output of a nav menu title is to use the the_title filter. This isn't ideal as this is also the filter used for the_title(). It also doesn't include any of the nav_menu specific arguments that are exposed inside the start_el() method except for the ID of the menu item.

I've attached a patch which introduces a separate filter for the title which includes the same arguments used by nav_menu_css_class, nav_menu_item_id, nav_menu_link_attributes and walker_nav_menu_start_el for consistency.

Attachments (2)

33447.diff (1.2 KB) - added by paulwilde 9 years ago.
33447.2.diff (1.2 KB) - added by paulwilde 9 years ago.

Download all attachments as: .zip

Change History (9)

9 years ago

#1 @paulwilde
9 years ago

  • Keywords has-patch added

#2 @paulwilde
9 years ago

  • Keywords dev-feedback added

#3 @kucrut
9 years ago

I think the filter should be named nav_menu_item_title instead to avoid confusion with the menu title/name.

Last edited 9 years ago by kucrut (previous) (diff)

#4 @johnbillion
9 years ago

  • Keywords needs-refresh added; dev-feedback removed
  • Milestone changed from Awaiting Review to 4.4
  • Version changed from trunk to 3.0

Unfortunately we have a mixture of nav_menu_* and nav_menu_item_* for our nav menu item filter names. nav_menu_item_title would be better.

9 years ago

#5 @paulwilde
9 years ago

  • Keywords needs-refresh removed

#6 @wonderboymusic
9 years ago

  • Owner set to johnbillion
  • Status changed from new to assigned

#7 @johnbillion
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 34666:

Add a nav_menu_item_title filter for filtering nav menu item titles.

Fixes #33447
Props paulwilde

Note: See TracTickets for help on using tickets.