nav_menu_item_title filter-hookWP 4.4.0

Filters a menu item's title.

Usage

add_filter( 'nav_menu_item_title', 'wp_kama_nav_menu_item_title_filter', 10, 4 );

/**
 * Function for `nav_menu_item_title` filter-hook.
 * 
 * @param string   $title     The menu item's title.
 * @param WP_Post  $menu_item The current menu item object.
 * @param stdClass $args      An object of wp_nav_menu() arguments.
 * @param int      $depth     Depth of menu item. Used for padding.
 *
 * @return string
 */
function wp_kama_nav_menu_item_title_filter( $title, $menu_item, $args, $depth ){

	// filter...
	return $title;
}
$title(string)
The menu item's title.
$menu_item(WP_Post)
The current menu item object.
$args(stdClass)
An object of wp_nav_menu() arguments.
$depth(int)
Depth of menu item. Used for padding.

Changelog

Since 4.4.0 Introduced.

Where the hook is called

Walker_Nav_Menu::start_el()
nav_menu_item_title
wp-includes/class-walker-nav-menu.php 230
$title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth );

Where the hook is used in WordPress

Usage not found.