mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Add a nav_menu_item_title filter for filtering nav menu item titles.
Fixes #33447 Props paulwilde git-svn-id: https://develop.svn.wordpress.org/trunk@34666 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
01ae35dc58
commit
aaa6e1c27e
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user