CMS · · 4 min read
Headless WordPress + Next.js: a battle plan for 2026
Auth, previews, ISR, image handling, and gotchas we've hit shipping 20+ headless WordPress builds.
What headless means
In a headless setup, WordPress remains the place where editors write and manage content, but it no longer renders the public website. A separate front end — here Next.js — fetches the content through the WordPress REST API or WPGraphQL and builds the pages.
The benefits are speed, security (the WordPress admin can sit on a private address), freedom in design, and the ability to send the same content to a website, apps and other channels. The costs are two systems to host and maintain, and features that WordPress themes and plugins normally provide must be rebuilt in the front end.
When it is worth it
- Large content sites and publishers where speed and scale matter.
- Brands that need a highly custom, app-like front end.
- Content shared across a website, mobile apps and other channels.
- Teams that already have React or Next.js developers.
For a brochure site or a small business with a few pages, a well-built traditional WordPress theme is usually cheaper and just as fast.
Rendering: static pages that stay fresh
Generate pages statically and serve them from a CDN, so visitors get HTML instantly. Instead of rebuilding the whole site, use on-demand revalidation: when an editor publishes or updates a post, a small WordPress hook calls a secret endpoint in Next.js, which revalidates only the affected pages or tags. Content is live within seconds, and pages stay fast.
// app/api/revalidate/route.js — called by WordPress on publish
import { revalidateTag } from 'next/cache';
export async function POST(request) {
const { secret, tag } = await request.json();
if (secret !== process.env.REVALIDATE_SECRET) {
return Response.json({ ok: false }, { status: 401 });
}
revalidateTag(tag);
return Response.json({ ok: true });
}
Previews for editors
Editors expect the Preview button to work. Use Next.js draft mode: WordPress links to a preview route with a secret and the post ID, the route enables draft mode, and the page fetches the latest revision with an authenticated request (for example with an application password or a token). Test previews for unpublished posts, scheduled posts and pages with custom fields.
SEO in a headless build
- Expose SEO plugin fields (title, description, canonical, social image, schema) through the API and render them in Next.js metadata.
- Generate the sitemap and robots.txt from the front end, using WordPress content.
- Manage redirects in WordPress and sync them to the front end, so editors keep control.
- Keep URLs identical during a migration, or redirect every old URL.
Images, forms and search
Serve WordPress media through Next.js image optimisation or an image CDN, with the WordPress media domain allowed in the configuration. Forms need a home: post them to a Next.js route that validates and forwards to your CRM or email, or use a form plugin’s API. Site search usually moves to a dedicated service or a simple API endpoint, because the theme’s search page no longer exists.
Gotchas we plan for
- Page builders store layout as shortcodes or proprietary markup that is hard to render elsewhere; prefer Gutenberg blocks or custom fields.
- Menus, widgets and plugin features that depend on a theme need API equivalents.
- Lock down the WordPress admin and disable the public theme to avoid duplicate content.
- Multilingual content needs a plugin with API support and a clear URL strategy in Next.js.
A checklist before you start
Agree the content model (post types, fields, blocks), how previews and publishing work, where redirects and SEO fields live, how forms and search are handled, and who hosts and monitors each half. With those decisions made up front, headless WordPress gives editors the tool they know and visitors a site that is fast everywhere.
Want us to look at your site?
Run the free website checker for an instant report, or create a ticket and an engineer will reply within one working day.