Fix color-contrast in WordPress
WordPress block themes and classic WooCommerce storefronts commonly trigger color-contrast errors through light meta dates (.entry-meta), pale placeholder/accent palette entries in theme.json, and WooCommerce .button.alt styles. Updating the central palette in theme.json or child-theme CSS resolves every post, archive, and product page simultaneously.
Before and after
/* Broken WordPress theme.json / child-theme style.css */
.entry-meta,
.wp-block-post-date {
color: #9ca3af; /* 2.43:1 on #f9fafb — fails WCAG 1.4.3 */
font-size: 0.875rem;
}
.woocommerce a.button.alt,
.wp-block-button__link {
background-color: #38bdf8;
color: #ffffff; /* 2.14:1 — fails WCAG 1.4.3 */
}/* Fixed WordPress theme.json palette + child-theme style.css */
:root {
--wp--preset--color--muted-ink: #475569; /* 7.58:1 on #ffffff */
--wp--preset--color--brand-cta: #0369a1; /* 5.93:1 with #ffffff */
}
.entry-meta,
.wp-block-post-date {
color: var(--wp--preset--color--muted-ink);
font-size: 0.875rem;
}
.woocommerce a.button.alt,
.wp-block-button__link {
background-color: var(--wp--preset--color--brand-cta);
color: #ffffff;
}Fixed vs. broken example
Inspect the foreground and background colors in Chrome DevTools Color Picker to verify the live WCAG AA (4.5:1 normal text, 3:1 large text) contrast badges.
Playwright + axe-core check
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
test("WordPress post archive & WooCommerce CTA pass color-contrast", async ({ page }) => {
await page.goto("/shop/");
const results = await new AxeBuilder({ page })
.withRules(["color-contrast"])
.analyze();
expect(results.violations).toEqual([]);
});Template deduplication tip
A single low-contrast .entry-meta or .woocommerce a.button rule in style.css repeats across thousands of /blog/* and /product/* URLs. A11yDrift's template fingerprinter rolls every post violation into one root WordPress stylesheet fix.
Who this affects
Low-vision readers, older users with presbyopia, people with color-vision deficiencies, and anyone viewing a screen in bright sunlight struggle or fail to read muted gray captions, pale badges, and low-contrast CTA buttons.
NVDA & VoiceOver transcript
Screen readers announce the same copy for both versions; this rule primarily impacts low-vision readers, screen magnifiers, and visual legibility.
NVDA (Windows)
Screen readers still speak "Free shipping on orders over $75" and "Add to Cart, button", but screen magnifier and low-vision users cannot visually locate or read the faded copy and pale blue button.
Screen readers announce "Free shipping on orders over $75" and "Add to Cart, button", while sighted low-vision and ZoomText users clearly distinguish both the 7.58:1 body copy and 5.93:1 CTA.
VoiceOver (macOS / iOS)
VoiceOver speaks "Add to Cart, button", yet users combining VoiceOver with Zoom or macOS Increase Contrast experience severe glare washout on the 2.14:1 sky-blue fill.
VoiceOver speaks "Add to Cart, button", and the 5.93:1 darkened surface stays legible across macOS Zoom, mobile sunlight, and high-brightness displays.
Common questions
How do I lock Gutenberg editors into accessible colors in WordPress?
Why do WooCommerce notices and 'Sale!' badges often fail axe-core contrast?
Does Gutenberg's built-in editor contrast warning catch every issue?
Test a URL for color-contrast
Enter any public URL for a free WCAG 2.2 AA check—no account or credit card required.
Managing WordPress client sites? Monitor 15 sites on one flat plan with white-label portals and branded executive PDFs—$1,140/yr ($95/mo billed annually, 24-month rate lock + onboarding) for Founding 10 agencies.