wppaste
WordPress

apply_filters( 'nav_menu_link_attributes', array $atts, WP_Post $menu_item, stdClass $args, int $depth )

Since
3.6.0, 4.1.0
Filters the HTML attributes applied to a menu item's anchor element.

Compatibility

WordPress
since 4.1.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$attsarray
{ The HTML attributes applied to the menu item's <a> element, empty strings are ignored.
@type string $title Title attribute.
@type string $target Target attribute.
@type string $rel The rel attribute.
@type string $href The href attribute.
@type string $aria-current The aria-current attribute.
}
  • $titlestring

    Title attribute.
  • $targetstring

    Target attribute.
  • $relstring

    The rel attribute.
  • $hrefstring

    The href attribute.
  • $aria-currentstring

    The aria-current attribute.
$menu_itemWP_Post
The current menu item object.
$argsstdClass
An object of wp_nav_menu() arguments.
$depthint
Depth of menu item. Used for padding.

Where this hook fires · 1

  • wp-includes/class-walker-nav-menu.php:297Walker_Nav_Menu::start_el()

Changelog

Introduced in 3.6.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.1.0
The $depth parameter was added.from the docblock
3.6.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.