Why This Issue Happens In Headless WordPress Via REST API
A **decorative image with descriptive alt** is a common accessibility failure in headless WordPress via REST API setups. The image is meant to add visual styling only, but the API delivers a non-empty `alt` value, so screen readers announce content that should have been ignored. That creates noise, slows navigation, and can confuse users about whether the image carries meaning.
In a traditional WordPress theme, editors and template logic may quietly handle some of this. In a headless stack, the front end must make an explicit decision about whether an image is informative or decorative. If that logic is missing, the application often renders every image with whatever alt text came from the media library, even when the image is purely ornamental.
The core selection criterion is simple: if removing the image does not change meaning, action, or understanding, it should usually be decorative and have empty alt text.
What Counts As A Decorative Image
A decorative image supports layout, branding atmosphere, spacing, or visual polish without adding information required to understand the page.
Common examples include:
- Background flourishes behind headings
- Divider graphics
- Repeated icon accents next to already clear text labels
- Mood imagery that duplicates nearby copy
- Thumbnail overlays used only for styling
These are different from informative images, such as:
- Product photos needed for purchase decisions
- Diagrams that explain a process
- Icons that are the only visible label for a control
- Author headshots in contexts where identity matters
If the image is decorative, the correct accessibility treatment is usually an empty alt attribute: `alt=""`.
The Failure Pattern In API-Delivered Media
In headless WordPress via REST API, the problem usually appears in one of three places.
Editors Add Well-Meaning But Unnecessary Alt Text
Content teams often enter descriptive alt text for every uploaded file because they want to be thorough. That instinct is understandable, but it can backfire when the same media asset is reused decoratively in another component.
A floral divider image might have alt text like "Blue watercolor border," which is then announced to assistive technology even though it adds no meaning.
Front-End Components Assume Every Image Needs Spoken Text
Some image components blindly map API fields into rendered markup:
<img src={image.source_url} alt={image.alt_text} />
That is safe only when the image is always informative. In design systems, the same component may be used for hero art, badges, cards, separators, and logos, all with different accessibility needs.
API Responses Do Not Encode Presentation Intent
The WordPress REST API can return media metadata, but it does not automatically know whether a specific page instance is decorative or meaningful in context. The same image can be informative on one page and decorative on another.
That means your front end, content model, or block serialization layer must carry intent.
How To Diagnose The Problem
Start by reviewing the rendered page, not just the CMS entry.
Use this quick checklist:
- Find images that are visually optional
- Inspect whether they render with non-empty `alt` text
- Check whether nearby text already communicates the same idea
- Test with a screen reader or accessibility tree viewer
- Confirm whether the image is inside a link or button, which changes the rule
A decorative image with descriptive alt is a failure because assistive technology announces content that should be skipped.
Common Scenarios And Their Limits
Below are the most frequent scenarios in headless WordPress via REST API projects and the right way to think about each one.
Decorative Hero Or Banner Art
Problem:
- Large header images often receive descriptive alt from the media library
Limitation:
- The image may feel important visually, but that does not make it informative semantically
When it appears:
- Marketing pages, campaign landers, article headers
Fix guidance:
- If the heading and body copy already communicate the message, use empty alt
- If the image conveys unique information not present in text, keep meaningful alt
Reused Icons Next To Visible Labels
Problem:
- A REST-fed icon appears next to text like "Email" or "Download" and still carries alt such as "Envelope icon"
Limitation:
- Repeated icon narration creates clutter without improving understanding
When it appears:
- Feature lists, metadata rows, CTA groups, navigation items
Fix guidance:
- If visible text already names the item, mark the icon decorative
- If the icon is the only label, it is not decorative
Card Thumbnails That Duplicate Adjacent Titles
Problem:
- Post cards render featured images with descriptive alt, while the linked title already identifies the content
Limitation:
- Whether the image is decorative depends on what the card needs to communicate
When it appears:
- Blog indexes, resource hubs, related content modules
Fix guidance:
- If the image adds no new meaning beyond the linked title and excerpt, consider empty alt
- If the image itself is the core content, write alt that reflects its function in the card
Background Images Promoted To Foreground `<img>` Elements
Problem:
- Design migrations sometimes convert CSS backgrounds into API-driven image elements for optimization
Limitation:
- Performance or responsive-image goals do not change accessibility requirements
When it appears:
- Next.js, Gatsby, Astro, and custom React front ends
Fix guidance:
- If the image still serves only presentation, render it with empty alt or keep it as a CSS background where appropriate
Decision Rules For Editors And Developers
The cleanest fix is to separate **media metadata** from **page-level presentation intent**.
Use this decision table:
| Scenario | Should It Have Descriptive Alt? | Recommended Treatment |
|---|---|---|
| Visual flourish only | No | `alt=""` |
| Repeated icon beside visible text | No | `alt=""` |
| Product or article image adding meaning | Yes | Specific alt text |
| Image-only link or button label | Yes | Alt should convey purpose |
| Diagram or chart | Yes | Alt plus surrounding explanation as needed |
Best Fixes By Audience And Use Case
For Content Teams
If editors control image selection but not rendering logic, create clear guidance:
- Do not assume every uploaded image needs to be announced everywhere
- Document what counts as decorative
- Flag components where image alt is ignored intentionally
- Use content notes or structured fields when an image is informative in one context but decorative in another
This avoids blaming editors for a front-end modeling problem.
For Front-End Developers
Do not rely on `alt_text` from the API as the only rule.
Instead, pass a decorative flag at the component level:
function ContentImage({ image, decorative = false }) {
return (
<img
src={image.source_url}
alt={decorative ? "" : (image.alt_text || "")}
/>
);
}
Better still, make intent explicit in the content model:
- `isDecorative: true`
- `imageRole: "decorative" | "informative"`
- `purpose: "presentation" | "content"`
That is more reliable than guessing from file names or placement.
For Component Library Maintainers
Design systems should avoid one-size-fits-all image primitives.
Recommended approach:
- Keep a low-level image component for raw rendering
- Build semantic wrappers for card images, icons, hero art, and author images
- Encode accessibility defaults per use case
- Require explicit override when a normally decorative pattern becomes informative
This reduces repeated mistakes across pages.
For SEO Stakeholders
A decorative image with descriptive alt does not improve SEO in any meaningful way. Alt text is not a dumping ground for extra keywords, and misleading alt can weaken accessibility quality.
Use alt text to describe meaningful images only. Decorative assets should stay silent to assistive technology.
Implementation Patterns That Work Well
In headless WordPress via REST API, these patterns are usually the most durable.
Pattern 1: Component-Level Decorative Prop
Best when:
- Your content model is simple
- Developers control component usage consistently
Pros:
- Fast to implement
- Clear in code reviews
Cons:
- Easy to misuse if teams forget to set the prop
Pattern 2: Structured CMS Field For Image Intent
Best when:
- Editors assemble pages in flexible content systems
- The same media appears in different contexts
Pros:
- Intent travels with the page entry
- Easier to audit systematically
Cons:
- Requires CMS schema changes and training
Pattern 3: Semantic Wrappers In The Design System
Best when:
- Multiple teams ship UI from a shared component library
Pros:
- Strong default behavior
- Fewer accessibility regressions
Cons:
- Needs up-front design system discipline
What Not To Do
Avoid these common fixes that look convenient but create new problems:
- Do not delete all alt text from the media library globally
- Do not force every API image to inherit the same fallback alt
- Do not stuff keywords into decorative image alt text
- Do not assume a visually prominent image is automatically informative
- Do not hide meaningful images just because the alt text is hard to write
Verification Steps Before Publishing
Use a short pre-publish review for any page type that consumes WordPress media via API.
- Identify whether each image is informative or decorative in context
- Confirm decorative images render with empty alt text
- Confirm informative images have concise, relevant alt text
- Test linked images and icon-only controls separately
- Run an accessibility audit and a quick screen reader pass
Helpful references:
Recommended Fix For Most Headless Setups
For most teams, the best fix for a **decorative image with descriptive alt** in **headless WordPress via REST API** is to stop treating media-library alt text as universal truth. Keep author-provided alt available for meaningful uses, but let the rendering context decide when an image is decorative.
If you need one practical rule, use this: when the image adds no information that a user needs, render it with empty alt text and keep it out of the accessibility experience. That approach is cleaner for users, more maintainable for developers, and more accurate than trying to describe every image by default.