WordPress fix

Before and after

Broken — before
<?php // page.php (Broken classic WordPress template using <div id="primary">) ?>
<?php get_header(); ?>
<div id="primary" class="content-area">
  <?php while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( 'template-parts/content', 'page' ); ?>
  <?php endwhile; ?>
</div>
<?php get_footer(); ?>
Fixed — after
<?php // page.php (Fixed WordPress template with semantic <main id="primary">) ?>
<?php get_header(); ?>
<main id="primary" class="site-main" tabindex="-1">
  <?php while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( 'template-parts/content', 'page' ); ?>
  <?php endwhile; ?>
</main>
<?php get_footer(); ?>
Live preview

Fixed vs. broken example

Passes landmark-one-main
Accessibility tree: Landmarks list: banner (<header>), main (<main id="main-content">)

Pair your single <main id="main-content" tabindex="-1"> landmark with a visible-on-focus "Skip to main content" link at the top of <body>.

Automated test

Playwright + axe-core check

tests/a11y-landmark-one-main.spec.ts
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";

test("WordPress pages and posts expose exactly one <main> landmark", async ({ page }) => {
  await page.goto("/about/");
  await expect(page.getByRole("main")).toHaveCount(1);
  const results = await new AxeBuilder({ page })
    .withRules(["landmark-one-main"])
    .analyze();
  expect(results.violations).toEqual([]);
});

Template deduplication tip

Adding <main id='primary'> across index.php, single.php, page.php, and archive.php (or your FSE template wrapper) eliminates landmark-one-main across thousands of WordPress URLs.

Screen readers

What NVDA and VoiceOver announce

Keyboard and screen-reader users rely on the <main> landmark (and Skip-to-Content links targeting it) to bypass 30+ repeating header, mega-menu, and announcement links on every page navigation.

NVDA (Windows)

Broken

Pressing D (next landmark) announces: "no next landmark"


Fixed

Pressing D jumps straight past navigation and announces: "main landmark"

VoiceOver (macOS / iOS)

Broken

Landmarks rotor shows no Main region; user must step through every header link.


Fixed

Landmarks rotor lists "main", letting the user jump directly to primary content.

Common questions

How do I set a <main> landmark in a WordPress Block Theme (FSE)?
In the Site Editor (Appearance -> Editor -> Templates), select the Group block wrapping Post Content / Query Loop, open the right-hand Advanced panel, and set HTML Element to <main>.
Where should the WordPress Skip-to-Content link live?
Place <a class='skip-link screen-reader-text' href='#primary'>Skip to content</a> immediately after wp_body_open() inside header.php so it is the very first Tab stop on every page.
Should a WordPress sidebar (<aside>) sit inside or outside <main>?
Place complementary sidebars (<aside>) as siblings outside <main> so screen-reader users jumping to <main> land directly in the primary article or WooCommerce product content.