nav_menu_submenu_css_class
Filters the CSS class(es) applied to a menu list element.
Usage
add_filter( 'nav_menu_submenu_css_class', 'wp_kama_nav_menu_submenu_css_class_filter', 10, 3 ); /** * Function for `nav_menu_submenu_css_class` filter-hook. * * @param string[] $classes Array of the CSS classes that are applied to the menu `<ul>` element. * @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_submenu_css_class_filter( $classes, $args, $depth ){ // filter... return $classes; }
- $classes(string[])
- Array of the CSS classes that are applied to the menu <ul> element.
- $args(stdClass)
- An object of wp_nav_menu() arguments.
- $depth(int)
- Depth of menu item. Used for padding.
Changelog
Since 4.8.0 | Introduced. |
Where the hook is called
nav_menu_submenu_css_class
wp-includes/class-walker-nav-menu.php 75
$class_names = implode( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) );