# nav_menu_link_attributes

URL: https://chugunov.pro/api-wordpress/filters/nav_menu_link_attributes/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: хук-фильтр.
Появился в версии: 3.6.0.

## Сигнатура

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

## Описание

Фильтрует HTML-атрибуты, применяемые к элементу-ссылке пункта меню.

## Параметры

- `$atts` `array` — обязательный. HTML-атрибуты, применяемые к элементу пункта меню; пустые строки игнорируются.
  
  title stringАтрибут title.
  
  target stringАтрибут target.
  
  rel stringАтрибут rel.
  
  href stringАтрибут href.
  
  aria-current stringАтрибут aria-current.
- `$menu_item` `WP_Post` — обязательный. Объект текущего пункта меню.
- `$args` `stdClass` — обязательный. Объект аргументов wp_nav_menu().
- `$depth` `int` — обязательный. Глубина пункта меню. Используется для отступов.

## Фильтруемое значение

HTML-атрибуты, применяемые к элементу пункта меню; пустые строки игнорируются.

title stringАтрибут title.

target stringАтрибут target.

rel stringАтрибут rel.

href stringАтрибут href.

aria-current stringАтрибут aria-current.

## Исходный код

Файл: `wp-includes/class-walker-nav-menu.php:297`

```php
$atts       = apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth );
```

## История изменений

- 4.1.0 — The $depth parameter was added.
- 3.6.0 — Introduced.

## Связанные

Используется в: `Walker_Nav_Menu::start_el`.

Оригинал в официальной документации: https://developer.wordpress.org/reference/hooks/nav_menu_link_attributes/
