Developers Tutorial Beginner 3 min

Accessible WordPress Menus: ARIA Labels, Skip Links and Focus States That Help

Five small fixes that make WordPress navigation work for keyboard and screen reader users: labelled menus, a skip link, visible focus, honest link text and respect for reduced motion.

TutorialBeginner12 minTested on WordPress 7.1Updated November 13, 2026

Press Tab on your home page and watch where the focus goes. On many WordPress sites it disappears into the header, hops through twenty menu links and only then reaches the content. A screen reader user hears “navigation, navigation, navigation” with no way to tell the main menu from the footer menu. These fixes take an afternoon.

1. Give every menu a name

A page usually has several <nav> areas: the main menu, a footer menu, social links, breadcrumbs. Screen readers list them by name, so “Main menu” and “Footer menu” are far more useful than three unnamed “navigation” landmarks.

wp_nav_menu() accepts a container_aria_label argument, and our snippet sets it for each menu location you list, so every menu gets its own short name:

functions.phpPHP
add_filter( 'wp_nav_menu_args', function ( array $args ): array {
	$labels = [
		'primary' => 'Main',
		'footer'  => 'Footer',
		'mobile'  => 'Mobile',
		'legal'   => 'Legal',
		'social'  => 'Social media',
	];

	$location = $args['theme_location'] ?? '';
	if ( ! isset( $labels[ $location ] ) ) {
		return $args;
	}

	// Wrap the menu in a <nav> and give it a name screen readers can announce.
	if ( empty( $args['container'] ) || 'div' === $args['container'] ) {
		$args['container'] = 'nav';
	}
	$args['container_aria_label'] = $labels[ $location ];

	return $args;
} );
Tested on WordPress 7.1 · PHP 8.3Checked November 13, 2026
Tip

Keep labels short and don’t include the word “navigation”: screen readers already say it. “Main” is read as “Main, navigation”.

Using a block theme or a page builder? The snippet only affects classic menus printed with wp_nav_menu(). In block themes, select the Navigation block and set its label under Advanced. In Bricks, the Nav Menu element has its own ARIA label setting.

A skip link is the first focusable thing on the page. It stays hidden until a keyboard user presses Tab, then appears as “Skip to content” and jumps straight past the header.

Snippet

Add a Skip to Content Link for Accessibility

Inject a visually hidden 'Skip to content' link at the top of every page that becomes visible on keyboard focus, allowing keyboard and screen reader users to bypass repeated navigation.

PHPBeginner
View

Point it at the element that wraps your main content, and make sure that element has a matching id. If your theme already has a skip link, check it works: many point to an id that no longer exists.

The skip link and other hidden labels rely on a “screen reader text” class that hides text visually but keeps it readable. Block themes and page builders don’t always include it:

Snippet

Add the Screen Reader Text CSS

Add WordPress's standard .screen-reader-text class for themes that are missing it, so hidden labels stay hidden visually but are still read out.

CSSBeginner
View

3. Make focus visible

Some themes remove the focus outline because it “looks messy” when clicking. Keyboard users then have no idea where they are. Use :focus-visible, which only shows the outline when someone is using the keyboard:

style.cssCSS
/* A clear focus ring for keyboard users only. */
:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid #6F58CA;
    outline-offset: 3px;
    border-radius: 4px;
}
Tested on WordPress 7.1 · PHP 8.3Add to: your child theme's style.css or Customizer → Additional CSSChecked November 13, 2026

Pick a colour with strong contrast against both your header and your page background. Check the menu, buttons, form fields and any dropdowns.

Links that open a new tab without warning disorient screen reader users, who suddenly find the Back button doesn’t work. The snippet adds hidden text, “(opens in a new tab)”, to every link in your post content with target="_blank":

Snippet

Tell Screen Reader Users When a Link Opens a New Tab

Add hidden "(opens in a new tab)" text to links in posts that open in a new tab, so screen reader users aren't surprised.

PHPIntermediate
View

5. Respect reduced motion

Some people get dizzy or nauseous from sliding menus, parallax and auto-playing animations. Their device can tell your site with the prefers-reduced-motion setting:

Snippet

Turn Off Animations for People Who Prefer Reduced Motion

Stop animations, transitions and smooth scrolling for visitors who have turned on "Reduce motion" on their device.

CSSBeginner
View

Test it in five minutes

0 / 5
Note

These fixes help a lot, but they aren’t a full accessibility audit. Colour contrast, form labels, headings and image alt text matter just as much. Our snippet library has tools for alt text in the media library too.

Check your understanding

1Why use :focus-visible instead of :focus?
2Should a menu’s aria-label include the word ‘navigation’?

Was this helpful?

Written by Nahnu Plugins

We build and maintain WordPress plugins. Every guide is tested on a fresh WordPress site before it goes out, and checked again when WordPress updates.

More guides

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only