Skip to content
WordPressRule: html-lang-valid•Reviewed Oct 2026

Use a valid BCP 47 language code on the html element in WordPress

The language code specified on `<html>` must be an authorized BCP 47 language tag.

What's wrong

Values like `lang="english"` or malformed region codes cause speech synthesis software to fail.

Who it affects

Screen readers fall back to default speech synthesizers or report language parsing errors.

How to fix on WordPress

Use WordPress's native `language_attributes()` function which extracts valid codes configured in General Settings.

Code example

Problematic Code
PHP
<html lang="en_US_custom">
Recommended Accessible Code
PHP
<html <?php language_attributes(); ?>>

How to check your fix

Validate the `lang` tag against the IANA language subtag registry (e.g. `en`, `en-US`, `fr`, `de`).

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)