nav_menu_submenu_attributes
Filters the HTML attributes applied to a menu list element.
Usage
add_filter( 'nav_menu_submenu_attributes', 'wp_kama_nav_menu_submenu_attributes_filter', 10, 3 );
/**
* Function for `nav_menu_submenu_attributes` filter-hook.
*
* @param array $atts The HTML attributes applied to the `<ul>` element, empty strings are ignored.
* @param stdClass $args An object of `wp_nav_menu()` arguments.
* @param int $depth Depth of menu item. Used for padding.
*
* @return array
*/
function wp_kama_nav_menu_submenu_attributes_filter( $atts, $args, $depth ){
// filter...
return $atts;
}
- $atts(array)
The HTML attributes applied to the
<ul>element, empty strings are ignored.- class(string)
HTML CSS class attribute.
- class(string)
- $args(stdClass)
- An object of
wp_nav_menu()arguments. - $depth(int)
- Depth of menu item. Used for padding.
Changelog
| Since 6.3.0 | Introduced. |
Where the hook is called
nav_menu_submenu_attributes
wp-includes/class-walker-nav-menu.php 110
$atts = apply_filters( 'nav_menu_submenu_attributes', $atts, $args, $depth );