Skip to content
WordPressRule: aria-roles•Reviewed Oct 2026

Use valid WAI-ARIA role values in WordPress themes

The `role` attribute must contain a valid, non-deprecated WAI-ARIA role string.

What's wrong

Misspelled roles like `role="btn"` or `role="nav"` are ignored by assistive tools.

Who it affects

Screen readers treat the element as generic text or a generic container, discarding accessibility semantics.

How to fix on WordPress

Update theme template files and block attributes to use valid ARIA role specifications.

Code example

Problematic Code
PHP
<nav role="navigation-bar">...</nav>
Recommended Accessible Code
PHP
<nav aria-label="<?php esc_attr_e( 'Main Menu', 'textdomain' ); ?>">...</nav>

How to check your fix

Inspect elements with `role` attributes in DevTools. Check against the W3C WAI-ARIA Roles specification.

Check if your site has this issue

Scan any public store page free against WCAG 2.2 AA in 30 seconds.

Your session has ended

Sign in again to carry on. Anything you typed on this page is kept.

Signed in another way? Use another method (opens a new tab)