nav_menu_item_id filter-hook . WP 3.0.1
Filters the ID applied to a menu item's list item element.
Usage
add_filter( 'nav_menu_item_id', 'filter_function_name_4381', 10, 4 ); function filter_function_name_4381( $menu_id, $item, $args, $depth ){ // filter... return $menu_id; }
- $menu_id(string)
- The ID that is applied to the menu item's <li> element.
- $item(WP_Post)
- The current menu item.
- $args(stdClass)
- An object of wp_nav_menu() arguments.
- $depth(int)
- Depth of menu item. Used for padding.
Changelog
Since 3.0.1 | Introduced. |
Since 4.1.0 | The $depth parameter was added. |
Where the hook is called
nav_menu_item_id
wp-includes/class-walker-nav-menu.php 167
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth );
Where in WP core the hook is used WordPress
wp-includes/class-walker-nav-menu.php 551
add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 );