How to Correctly Set Alt Text for Decorative Images in WordPress
Most accessibility guides advise adding alt text to every image, but decorative images — such as dividers, background textures, and ornaments — should have an empty alt attribute so screen readers skip them entirely. Leaving the alt attribute out altogether is equally problematic, as some screen readers will then read the raw file name aloud to users. In WordPress's block editor, leaving the 'Alternative text' field blank correctly outputs alt="" in the HTML, which is the intended behavior. Icons that duplicate adjacent text labels are decorative and need empty alt text, while standalone clickable icons with no visible label are meaningful and require descriptive alt text. Editors can verify correct implementation by previewing a page and checking the source HTML to confirm decorative images display alt="" rather than a missing attribute.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in