nav_menu_item_args filter-hookWP 4.4.0

Filters the arguments for a single nav menu item.

Usage

add_filter( 'nav_menu_item_args', 'wp_kama_nav_menu_item_args_filter', 10, 3 );

/**
 * Function for `nav_menu_item_args` filter-hook.
 * 
 * @param stdClass $args      An object of wp_nav_menu() arguments.
 * @param WP_Post  $menu_item Menu item data object.
 * @param int      $depth     Depth of menu item. Used for padding.
 *
 * @return stdClass
 */
function wp_kama_nav_menu_item_args_filter( $args, $menu_item, $depth ){

	// filter...
	return $args;
}
$args(stdClass)
An object of wp_nav_menu() arguments.
$menu_item(WP_Post)
Menu item data object.
$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_args
wp-includes/class-walker-nav-menu.php 163
$args = apply_filters( 'nav_menu_item_args', $args, $menu_item, $depth );

Where the hook is used in WordPress

Usage not found.