# Remove Redundant Title Attributes From Menu Links

> Strips title attributes from menu links when they only repeat the visible link text, which makes screen readers announce the same words twice.

- Type: PHP
- Runs: Frontend only
- Category: [Accessibility](https://wpide.com/library/category/accessibility/)
- Tags: menus, title-attribute, screen-reader
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/a11y-remove-redundant-link-titles/

## Code

```php
add_filter( 'nav_menu_link_attributes', function ( $atts, $item ) {
    if ( empty( $atts['title'] ) ) {
        return $atts;
    }

    $text = strtolower( trim( wp_strip_all_tags( $item->title ) ) );

    if ( strtolower( trim( $atts['title'] ) ) === $text ) {
        unset( $atts['title'] );
    }

    return $atts;
}, 10, 2 );
```

## Notes

Titles that add new information are kept; only exact repeats of the link text are removed.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Remove Redundant Title Attributes From Menu Links" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
