Keep WordPress as a headless CMS, retire it, or move one section at a time? How each path affects editors, security and SEO risk, with a weighted scoring rubric to fill in for your own site.

Once Next.js is going to render your public site, the next question is what happens to WordPress. You can keep it as a headless CMS, retire it completely, or run both and move one section at a time.
The short answer: keep WordPress headless if your editors or a plugin-driven feature cannot move; migrate fully if developers own the content; phase it if the site is too big to freeze.
Each path changes something different: your editors’ day, your security workload, or your launch-day SEO risk. This guide compares them and ends with a rubric you can score for your own site. It is part of our WordPress to Next.js migration guide.
Choose headless when the people who publish are the bottleneck you cannot afford to disrupt: a newsroom with daily deadlines, a content team trained on the block editor, or a content model built from dozens of custom post types and ACF field groups that would take months to remodel.
Both are viable. WPGraphQL’s footing has improved: in 2024 its creator announced it was becoming a canonical WordPress plugin, with Automattic supporting its development. But every plugin in a headless stack is still code exposed to the internet: in 2026 WPGraphQL patched several vulnerabilities, including CVE-2026-40762, an unauthenticated SQL injection fixed in version 2.11.1. The REST API adds nothing beyond core, and its main drawback, over-fetching, is largely solved by _fields, which has supported nested properties since WordPress 5.3.

Editors expect “Update” to change the live site. Statically rendered pages can be refreshed on demand by calling revalidatePath from a Route Handler (the Next.js tab), and a small must-use plugin can call that handler whenever a post is saved (the PHP tab):
import { timingSafeEqual } from 'node:crypto'
import { revalidatePath } from 'next/cache'
import type { NextRequest } from 'next/server'
// Constant-time comparison, and no secret configured means no access.
function hasValidSecret(received: string | null) {
const expected = process.env.REVALIDATE_SECRET
if (!expected || !received) return false
const a = Buffer.from(received)
const b = Buffer.from(expected)
return a.length === b.length && timingSafeEqual(a, b)
}
export async function POST(request: NextRequest) {
if (!hasValidSecret(request.headers.get('x-revalidate-secret'))) {
return Response.json({ ok: false }, { status: 401 })
}
let path: string | undefined
try {
;({ path } = (await request.json()) as { path?: string })
} catch {
return Response.json({ ok: false }, { status: 400 })
}
if (!path || !path.startsWith('/blog/')) {
return Response.json({ ok: false }, { status: 400 })
}
revalidatePath(path) // the post itself
revalidatePath('/blog', 'layout') // every listing, tag and page under /blog
return Response.json({ ok: true })
}<?php
// wp-content/mu-plugins/revalidate-nextjs.php
// REVALIDATE_SECRET is defined in wp-config.php.
function example_revalidate_post(string $slug): void {
if (!defined('REVALIDATE_SECRET') || $slug === '') return;
$response = wp_remote_post('https://www.example.com/api/revalidate/', [
'headers' => [
'Content-Type' => 'application/json',
'x-revalidate-secret' => REVALIDATE_SECRET,
],
'body' => wp_json_encode(['path' => '/blog/' . $slug . '/']),
'timeout' => 5,
]);
// Waits for the answer so a failure is logged, not silently lost.
if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
error_log('Next.js revalidation failed for /blog/' . $slug . '/');
}
}
// Publish, update, unpublish and trash. Drafts never touch the live site.
add_action('transition_post_status', function ($new_status, $old_status, $post) {
if ($post->post_type !== 'post') return;
if ($new_status !== 'publish' && $old_status !== 'publish') return;
// WordPress appends __trashed to the slug before this hook runs.
example_revalidate_post(preg_replace('/__trashed$/', '', $post->post_name));
}, 10, 3);
// A changed slug leaves the old URL cached, so refresh that too.
add_action('post_updated', function ($post_id, $after, $before) {
if ($after->post_type !== 'post' || $before->post_status !== 'publish') return;
if ($before->post_name !== $after->post_name) {
example_revalidate_post($before->post_name);
}
}, 10, 3);Three details in that hook are easy to get wrong:
__trashed before the status hook runs, so the hook strips it, or the deleted post stays live.post_updated hook refreshes the old path as well.Pages outside /blog that list posts, such as the home page or a feed, need their own revalidatePath call. A shared secret compared in constant time is the minimum. Signing the request body and verifying the signature is stronger, and it is what our own site does: its publish webhook checks the CMS’s signature before purging any cache.
Tagging fetches instead of paths? In Next.js 16 revalidateTag takes a second argument: the docs recommend revalidateTag(tag, 'max'), mark the single-argument form deprecated, and suggest { expire: 0 } for a webhook that needs the data gone immediately.
Losing “Preview” is the first complaint editors raise about headless setups. Next.js Draft Mode solves it: a secret-protected route turns Draft Mode on and redirects to the page, which then fetches unpublished content. Headless CMS vendors build on the same mechanism; Sanity’s Visual Editing setup for the App Router enables Draft Mode through a route its Studio calls.
import { draftMode } from 'next/headers'
import { redirect } from 'next/navigation'
// GET, because WordPress opens it in a new tab from the Preview button.
export async function GET(request: Request) {
const { searchParams } = new URL(request.url)
if (!process.env.PREVIEW_SECRET || searchParams.get('secret') !== process.env.PREVIEW_SECRET) {
return new Response('Invalid token', { status: 401 })
}
// The post ID, not the slug: a never-published draft has no slug yet.
const id = searchParams.get('id') ?? ''
if (!/^\d+$/.test(id)) {
return new Response('Invalid post ID', { status: 400 })
}
;(await draftMode()).enable()
redirect(`/blog/preview/${id}/`)
}The route only switches Draft Mode on. The rest of preview lives on the WordPress side and in one more page:
/blog/preview/[id] page should fetch the post’s latest autosave (or the post itself with context=edit) using an Application Password, and only when draftMode().isEnabled is true.noindex.X-Robots-Tag: noindex on every front-end response.yoast_head_json, canonical included. If WordPress’s site address is the CMS hostname, those canonical and Open Graph URLs will be too. Configure WordPress to use your real domain, or rewrite the hostname when you map the fields.Headless keeps WordPress, so it keeps WordPress’s patching load. Patchstack logged 11,334 new vulnerabilities in the WordPress ecosystem in 2025, 91% of them in plugins and 46% unpatched when disclosed. Hiding the CMS from the public internet narrows the exposure but not the update work. Add the Next.js side, which since July 2026 has pre-announced security releases roughly once a month, and plan for two update cycles.
Choose a full migration when developers already own the site, the content is mostly articles and landing pages, and retiring WordPress removes a real burden (security updates, hosting, plugin licences) rather than just a technology you dislike.
The cost lands on editors. They move to one of three models:
The best CMS for Next.js compares these in detail. Whichever you choose, the content has to be exported and converted once; how to export WordPress to MDX covers that pipeline.
A phased migration runs both stacks on one domain. Next.js serves what has been rebuilt and forwards every other request to WordPress, so you can move the blog first, then landing pages, then the rest, with a smaller URL change at each step.
Next.js documents this as incremental adoption. Its fallback rewrites are applied after dynamic routes and all static assets have been checked, just before the 404 page, so you can proxy everything Next.js does not handle to the old site without touching the config each time a section moves:
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
trailingSlash: true,
async rewrites() {
return {
fallback: [
// Files keep their exact path
{
source: '/:path(.*\\.\\w+)',
destination: 'https://legacy.example.com/:path',
},
// Pages keep WordPress's trailing slash, so WordPress never redirects to add it
{
source: '/:path*',
destination: 'https://legacy.example.com/:path*/',
},
],
}
},
}
export default nextConfigFour things to know before you rely on it:
app/[slug]/page.tsx, or a section route that calls notFound() for posts it has not migrated yet, answers with a 404 and never reaches WordPress. Avoid root-level dynamic segments during the migration, and move a section only when every URL in it exists in Next.js./:path* form, WordPress answered /old-page/ with a redirect to its own hostname and the visitor left the site. For any redirect WordPress still issues, map X-Forwarded-Host in wp-config.php, trusting it only from your proxy, so the Location header names the public domain./wp-admin/, /wp-login.php, /xmlrpc.php and /wp-json/ onto your public domain. Return a 404 for those paths in Proxy.What makes phased migrations go wrong is inconsistency between the two stacks:
X-Robots-Tag: noindex would deindex every proxied page on the public domain too. Make it conditional: have Proxy add a secret request header to proxied requests, and have WordPress send noindex only when that header is missing. Check both hostnames with curl -I.Define the exit criteria up front: when the last section moves, remove the fallback rewrite and retire the legacy origin. Phased migrations that never finish leave you paying for both stacks indefinitely.
Score each criterion from 1 to 5, where 1 means it strongly favours a full migration and 5 means it strongly favours headless. Multiply each score by its weight and add them up. The total runs from 14 to 70: above 46 points to headless, below 38 to a full migration, and anything in between is close enough to decide on cost, or to phase.

If plugin-driven functionality scores 4 or 5, look hard at a phased approach: move the content-heavy sections to Next.js and leave the functional parts (a WooCommerce store, an LMS) on WordPress until their replacements are properly scoped.
Scores close, or not sure how to rate a row? In a free 15-minute audit we look at your site with you on a live screen-share and tell you which path we would take and why.
This site runs the full-migration end state: Next.js on Vercel, content in Sanity, three domains served from one deployment, and a publish webhook that refreshes cached pages when an editor publishes. For clients we usually recommend the same when their team is ready to leave WordPress, as ProEd did, and a headless or phased route when a plugin-driven feature has to keep running.
It can be excellent, because Next.js gives you full control over HTML, performance and metadata. The risks are specific and fixable: hide the WordPress front end from crawlers, make sure canonicals use the public domain, and generate the sitemap from Next.js.
Yes, and it is a sensible path. Once Next.js renders the site, WordPress is just a data source. You can later move the content to another CMS or to files and swap the data layer without changing public URLs.
It reduces exposure, especially if the admin and theme are no longer publicly reachable, but WordPress core, plugins and the API you use still need regular updates.
Not if you build it. Next.js Draft Mode, a filtered preview link and a page that fetches the latest autosave restore preview. Budget development time for it from the start, because it is the first thing editors notice is missing.
Fill in the rubric above with whoever owns your content. Ten minutes together will settle more than a week of debate about stacks.
Our web design team builds headless and fully migrated Next.js sites, and will tell you honestly which one your site needs.
Ready when you are