Skip to content
WordPressRule: aria-allowed-attr•Reviewed Oct 2026

Use only permitted ARIA attributes on HTML elements in WordPress

ARIA attributes must only be used on elements whose role supports them.

What's wrong

Using attributes like `aria-expanded` on `role="link"` or elements that do not support expansion creates conflicting semantics.

Who it affects

Screen readers may ignore the attribute or report incorrect widget behavior to the user.

How to fix on WordPress

Use `<button type="button" aria-expanded="false">` for dropdown menu triggers instead of anchor links.

Code example

Problematic Code
PHP
<span aria-expanded="false" class="dropdown-toggle">Categories</span>
Recommended Accessible Code
PHP
<button type="button" aria-expanded="false" class="dropdown-toggle">
  <?php esc_html_e( 'Categories', 'textdomain' ); ?>
</button>

How to check your fix

Run axe DevTools and verify that no 'aria-allowed-attr' violations are reported for interactive components.

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)