From 51667f882a3604f6be19cf68b0574295ba804f23 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 28 Sep 2015 18:41:26 +0000 Subject: [PATCH] Add a `nav_menu_item_title` filter for filtering nav menu item titles. Fixes #33447 Props paulwilde Built from https://develop.svn.wordpress.org/trunk@34666 git-svn-id: http://core.svn.wordpress.org/trunk@34630 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/nav-menu-template.php | 18 ++++++++++++++++-- wp-includes/version.php | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index 13a9e735f4..8c74758b09 100644 --- a/wp-includes/nav-menu-template.php +++ b/wp-includes/nav-menu-template.php @@ -160,10 +160,24 @@ class Walker_Nav_Menu extends Walker { } } + /** This filter is documented in wp-includes/post-template.php */ + $title = apply_filters( 'the_title', $item->title, $item->ID ); + + /** + * Filter a menu item's title. + * + * @since 4.4.0 + * + * @param string $title The menu item's title. + * @param object $item The current menu item. + * @param array $args An array of {@see wp_nav_menu()} arguments. + * @param int $depth Depth of menu item. Used for padding. + */ + $title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth ); + $item_output = $args->before; $item_output .= ''; - /** This filter is documented in wp-includes/post-template.php */ - $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; + $item_output .= $args->link_before . $title . $args->link_after; $item_output .= ''; $item_output .= $args->after; diff --git a/wp-includes/version.php b/wp-includes/version.php index f36f3291c7..5eab0dc0ce 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34665'; +$wp_version = '4.4-alpha-34666'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.