No. 04Next.js8 min read2,082 words
WordPress to Next.js migration: when and how to do it
A practical guide to WordPress to Next.js migration for founders and teams: when it pays off, choosing a CMS, protecting SEO with redirects, and timelines.
- Written by
- Lazy Devs
- Published
- Updated
- Sources
- Cited inline

Key takeaways · 05
The short version
- 01Migrate from WordPress to Next.js when you are fighting performance after the usual fixes, your site is turning into an application, or plugin sprawl has become a security and maintenance burden. Otherwise, a well-tuned WordPress site is fine.
- 02Choose the CMS before writing front-end code: headless WordPress keeps the editor your team knows, a dedicated headless CMS gives cleaner structured content, and Markdown in Git suits developer-only teams.
- 03Protect SEO with a complete redirect map: export every indexed URL, keep URLs identical where possible, and permanently redirect the rest in a single hop.
- 04In Next.js, permanent redirects return HTTP 308, which Google treats the same as 301. For more than about a thousand redirects, use Proxy with a lookup table instead of next.config.
- 05Migrate first on the existing design, then redesign. Doing both at once doubles the risk and makes it impossible to tell what caused a traffic change.
On this page · 08
A WordPress to Next.js migration is worth it when your site is slow despite the usual fixes, is turning into an application, or has accumulated plugins that are a security and maintenance burden. Done well, you keep your rankings, your editors keep a friendly CMS, and the site gets faster and easier to change. Done carelessly, a migration can wipe out search traffic you spent years earning.
WordPress powers a large share of the web for good reasons: it is cheap to start, easy to staff, and a non-technical person can publish a post without calling anyone. So before we talk about leaving it, let's be honest. Most sites do not need to leave. The ones that do share a few specific symptoms, and if you do not have them, a migration is an expensive way to feel modern.
When a WordPress to Next.js migration is worth it
A WordPress to Next.js migration makes sense when you keep hitting the same walls:
| Symptom | Why it points to a migration | Try this first |
|---|---|---|
| Slow on mobile despite caching, CDN and better hosting | The bottleneck is the stack: PHP rendering, plugin queries, a heavy theme | A lighter theme, fewer plugins, image fixes |
| The site is growing app features | Dashboards, bookings, gated content and custom data fight WordPress | Check whether a plugin genuinely covers it |
| Plugin sprawl | Each plugin is something that can break, be abandoned or be exploited | Remove unused plugins, consolidate |
| Your developers work in React and TypeScript | Maintaining PHP themes is slow and unpleasant for them | Headless WordPress as a halfway step |
| Redesigns are painful | Theme and content are tangled together | Structured content in a block-based setup |
When we take over an older WordPress site, we often find plugins nobody remembers installing, and several that do overlapping jobs. That alone is not a reason to migrate, but combined with performance or app-like requirements, it usually tips the balance.
If none of those apply, stay put. A well-tuned WordPress site with a good host and a light theme is perfectly fine, and we will tell you that for free. Our Next.js vs WordPress comparison covers the trade-offs side by side.
What you gain by moving to Next.js
Next.js gives you control over how and when each page is built. Marketing pages and blog posts can be pre-rendered and served from a CDN, so they load almost instantly because no server has to assemble them when a visitor arrives. Pages that need fresh data render on the server per request. You choose per page instead of accepting one global behaviour.
Performance is the headline most founders care about, and it is real. But the bigger long-term win is that the site becomes ordinary code:
- Everything lives in Git, so every change is reviewed, versioned and reversible.
- Every change gets a preview deployment before it goes live.
- Deploys are predictable, with no plugin auto-updates changing production behind your back.
- You hire from the large React and TypeScript talent pool, not the smaller one of people who enjoy WordPress internals.
- Metadata, structured data and images are handled in code, consistently, instead of by a stack of plugins.
You also get a clean split between content and presentation, which leads to the question everyone forgets to ask early.
Choose the CMS before you write any code
Here is the trap. Founders picture the new fast site and forget that the marketing team still needs to publish posts without filing a ticket. Next.js is not a CMS. You pair it with one, and that choice shapes the whole project.
| Option | Editors | Pros | Cons |
|---|---|---|---|
| Headless WordPress | Keep the admin they know | Lowest friction, no content migration | You still run and patch WordPress and its plugins |
| Dedicated headless CMS (Sanity, Storyblok, Payload and others) | Learn a new editor | Clean structured content, better preview and roles | Content must be migrated and remodelled |
| Markdown or MDX in Git | Must be comfortable with Git or a Git-based editor | Simple, fast, free, versioned | Wrong for most marketing teams |
There is no universally right answer; it depends on who publishes and how often. If the terminology is new, start with what is a headless CMS, and for how to choose between products, see headless CMS for marketing teams and our comparison of the best headless CMS options in 2026. Decide before anyone writes front-end code, because switching CMS midway is a common cause of blown budgets.
Getting content out of WordPress
Whichever route you take, you need your content out of WordPress in a structured form. The built-in WordPress REST API is usually the best source, because it returns clean fields rather than a theme's HTML. It is paginated, with at most 100 items per page, so a migration script has to walk every page:
// scripts/export-wordpress.ts
type WpPost = {
id: number;
slug: string;
link: string;
date: string;
modified: string;
title: { rendered: string };
content: { rendered: string };
excerpt: { rendered: string };
};
export async function fetchAllPosts(siteUrl: string): Promise<WpPost[]> {
const posts: WpPost[] = [];
let page = 1;
let totalPages = 1;
do {
const res = await fetch(
`${siteUrl}/wp-json/wp/v2/posts?per_page=100&page=${page}&_embed`,
);
if (!res.ok) throw new Error(`WordPress API returned ${res.status}`);
totalPages = Number(res.headers.get("X-WP-TotalPages") ?? "1");
posts.push(...((await res.json()) as WpPost[]));
page += 1;
} while (page <= totalPages);
return posts;
}Keep the link field: it is the old URL, and it becomes the source side of your redirect map. Expect the body HTML to need cleaning: shortcodes, page-builder markup and inline styles rarely belong in a new structured CMS. Images referenced in posts need downloading, re-uploading and resizing, which is a good moment to apply everything in our image optimization guide.
How to protect SEO when migrating from WordPress
This is where migrations go to die, because a careless one can tank traffic you spent years earning. Google's guide to site moves with URL changes is worth reading in full. Our non-negotiables:
- Export every URL before you touch anything. Combine the sitemap, the REST API
linkfields, a crawl of the live site, and the pages with impressions in Search Console. The day after launch is the wrong time to discover a few hundred you missed. - Keep URLs identical where you can. The safest redirect is the one you do not need.
- Redirect every changed URL permanently, in a single hop. Old URL straight to new URL, never through a chain.
- Carry over metadata. Titles, meta descriptions, canonical tags, Open Graph data and structured data all need to come across. In Next.js this is the job of the
generateMetadatafunction, but it does not happen by accident. - Keep the sitemap and robots rules consistent, and submit the new sitemap in Search Console at launch.
- Do not drop content. Thin or missing pages after a migration lose rankings even with perfect redirects.
- Check Core Web Vitals on real devices. This is usually where the new site wins, and that win is worth protecting.
Redirects in Next.js
For a modest number of redirects, use the redirects option in next.config.ts. A common case is WordPress date-based permalinks moving to a cleaner blog path:
// next.config.ts
import type { NextConfig } from "next";
const config: NextConfig = {
async redirects() {
return [
{
// /2024/05/my-post -> /blog/my-post
source: "/:year(\\d{4})/:month(\\d{2})/:slug",
destination: "/blog/:slug",
permanent: true,
},
{ source: "/category/:name", destination: "/blog/tag/:name", permanent: true },
{ source: "/feed", destination: "/rss.xml", permanent: true },
];
},
};
export default config;Three details trip people up:
- Next.js permanent redirects return 308, not 301. That is fine: Google's documentation on redirects treats 301 and 308 the same, as permanent moves.
- Trailing slashes. WordPress URLs usually end in a slash; Next.js by default redirects to the version without one, and that normalization can add a hop before your own redirect runs. Either set the
trailingSlashoption to match your old URLs, or handle legacy URLs in Proxy, and test that every old URL lands on its final destination in one hop. - Scale. The Next.js redirecting guide notes that platforms may limit config-based redirects (Vercel's limit is 1,024) and recommends handling large redirect maps in Proxy, the Next.js 16 name for middleware, with a fast lookup such as a key-value store.
Test the redirect map before launch
Do not trust a redirect map you have not tested. Run every old URL against the staging site and assert it lands on a 200 page in one hop. It is the kind of cheap, high-value automated check we argue for in a testing strategy that pays off:
// scripts/check-redirects.ts
const STAGING = process.env.STAGING_URL!;
export async function checkRedirect(oldPath: string, expectedPath: string) {
const first = await fetch(`${STAGING}${oldPath}`, { redirect: "manual" });
const location = first.headers.get("location") ?? "";
if (![301, 308].includes(first.status) || !location.endsWith(expectedPath)) {
throw new Error(`${oldPath}: got ${first.status} to "${location}"`);
}
const final = await fetch(new URL(location, STAGING), { redirect: "manual" });
if (final.status !== 200) {
throw new Error(`${oldPath}: destination returned ${final.status}`);
}
}After launch, keep Search Console open for several weeks, watching the Pages report for new 404s and the Performance report for drops on specific URLs. A small wobble for a week or two is normal. A cliff means a redirect, a canonical or a noindex tag went wrong, and you fix it fast.
Timelines and what drives cost
These are rough ranges, not quotes, and they move with content volume and custom functionality:
| Site type | Typical scope | Rough timeline |
|---|---|---|
| Small marketing site or blog | 10 to 40 pages, light custom work | A few weeks |
| Mid-size content site | Hundreds of posts, CMS migration, custom layouts | Two to three months |
| Content site plus app features | Accounts, dashboards, integrations | Several months; this is a product build |
The biggest cost driver is rarely the front end. It is content migration and the CMS decision, exactly the parts people skip past in the first call. Plan for ongoing hosting too: a production Next.js site needs a proper hosting plan, and while it is usually modest, it is a different line item from a cheap shared WordPress plan. Our guide to the best hosting for Next.js compares the realistic options.
What quietly wrecks WordPress migrations
- Forgotten plugin features. Forms, comments, search, popups, related posts, cookie consent, SEO fields: WordPress gives you these through plugins. In Next.js you build or integrate each one. Inventory every plugin and what it actually does before scoping, because "oh, and the contact form" has eaten many timelines.
- An incomplete redirect map. It is the most commonly skipped step and the most expensive to fix after launch.
- Shortcodes and page-builder markup left in migrated content, rendering as raw text on the new site.
- Editor training. If the CMS changes, the content team needs real time to learn it on their own content before launch.
- Scope creep disguised as a redesign. Migrating and redesigning at once doubles the surface area and the risk. If you can, migrate on the existing design, then redesign. Mixing them makes it impossible to tell whether a traffic dip came from the new tech or the new layout.
A practical migration plan
- Audit the current site: URLs, traffic, plugins, templates and integrations.
- Choose the CMS based on who publishes and how often.
- Build the redirect map and the metadata plan.
- Build the Next.js front end, keeping URLs where possible.
- Migrate and clean content, including images.
- Test redirects, metadata, forms and performance on staging.
- Launch, submit the sitemap, and monitor Search Console daily for the first weeks.
Moving from WordPress to Next.js is a strong call when you are fighting performance, outgrowing the platform or building something closer to an app. It is the wrong call if you mostly want to feel current. If you go ahead, spend your early energy on the two things most teams underestimate: choosing the right CMS for the people who publish, and a complete redirect and metadata plan so your SEO survives the move.
We run these migrations end to end, from the URL audit to post-launch monitoring. If you want an honest opinion on whether your site is a good candidate, tell us about it and we will tell you either way.
Before you switch DNS, work through our website launch checklist: redirects, sitemaps, analytics and monitoring are where migrations usually slip.
For the search side of the move, our free site migration SEO checklist covers redirect mapping, canonicals and Search Console step by step.
FAQ · 05 questions
Frequently asked questions
Will moving from WordPress to Next.js hurt my SEO?
Not if it is done carefully. Rankings drop after migrations mainly because of missing redirects, changed URLs, lost metadata or missing content. Keep URLs the same where you can, redirect every changed URL permanently, carry over titles, descriptions and structured data, and monitor Search Console closely for several weeks after launch.
Can I keep using WordPress as the CMS with Next.js?
Yes. Headless WordPress keeps the WordPress admin for editors while Next.js renders the public site, pulling content through the built-in REST API or a GraphQL plugin. It is often the lowest-friction option when the content team is attached to WordPress, though you still maintain the WordPress install and its plugins.
How long does a WordPress to Next.js migration take?
As a rough guide, a small marketing site or blog takes a few weeks, a mid-size content site with a CMS migration and custom layouts takes two to three months, and a site with application features such as accounts and dashboards takes several months. Content volume and custom functionality drive the timeline more than the front end does.
Is Next.js faster than WordPress?
Usually, when built well, because pages can be pre-rendered and served from a CDN instead of being assembled by PHP and plugins on each request. But speed comes from the build, not the label. A lean WordPress site with good hosting can be fast, and a careless Next.js site can be slow.
What happens to WordPress plugins when I move to Next.js?
They do not come with you. Each plugin's job, such as forms, SEO fields, search, comments or e-commerce, has to be rebuilt, replaced with a service, or dropped. Inventory every plugin and what it actually does before scoping the project, because this is where hidden work usually sits.