nav_menu_submenu_attributes filter-hookWP 6.3.0

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.
$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

Walker_Nav_Menu::start_lvl()
nav_menu_submenu_attributes
wp-includes/class-walker-nav-menu.php 93
$atts       = apply_filters( 'nav_menu_submenu_attributes', $atts, $args, $depth );

Where the hook is used in WordPress

Usage not found.