WordPress at a glance
filter is not described

nav_menu_link_attributes filter-hook . WP 3.6.0

Filters the HTML attributes applied to a menu item's anchor element.


add_filter( 'nav_menu_link_attributes', 'filter_function_name_868', 10, 4 );
function filter_function_name_868( $atts, $item, $args, $depth ){
	// filter...

	return $atts;

The HTML attributes applied to the menu item's <a> element, empty strings are ignored.

  • $title (string)
    Title attribute.

  • $target (string)
    Target attribute.

  • $rel (string)
    The rel attribute.

  • $href (string)
    The href attribute.

  • $aria_current (string)
    The aria-current attribute.
The current menu item.
An object of wp_nav_menu() arguments.
Depth of menu item. Used for padding.


Since 3.6.0 Introduced.
Since 4.1.0 The $depth parameter was added.

Where the hook is called

wp-includes/class-walker-nav-menu.php 202
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );

Where the hook is used (in WP core)

Usage not found!