nav_menu_item_args
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
nav_menu_item_args
wp-includes/class-walker-nav-menu.php 163
$args = apply_filters( 'nav_menu_item_args', $args, $menu_item, $depth );