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
This commit is contained in:
John Blackbourn 2015-09-28 18:41:26 +00:00
parent 8d362918a8
commit 51667f882a
2 changed files with 17 additions and 3 deletions

View File

@ -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 .= '<a'. $attributes .'>';
/** 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 .= '</a>';
$item_output .= $args->after;

View File

@ -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.