Engineering7 min read
WordPress to Next.js migration: why now, and what it takes
Two unauthenticated remote code execution flaws hit WordPress and PHP in 2026. What that changes, why Next.js is the usual replacement, and what the move involves.
For years the case for leaving WordPress was about speed and developer taste, and it was easy to postpone. In 2026 it became a security argument with dates attached.
This is what happened, what it does and does not prove, and what a migration to Next.js really involves, taken from a rebuild we shipped this month: a three-language site of about 2,900 URLs, redesigned and moved in roughly a month.
What changed in 2026
July: WordPress core. Searchlight Cyber reported an unauthenticated remote code execution flaw in WordPress core and named it wp2shell. By their own account it was the first vulnerability of its kind in core in almost a decade. WordPress shipped the fix in 7.0.2 on 17 July. Proof-of-concept code was public within hours, mass exploitation was reported on 19 July, and CISA listed it as exploited on 21 July.
October: PHP itself. On 21 October the PHP project released fixes for two critical flaws, CVE-2026-109618 and CVE-2026-109619, now known as php2shell. The PHP Foundation's own description is that under the right conditions they let an unauthenticated attacker execute code on a server running PHP. On Apache with mod_php one of them can be triggered before any application code runs. The fixed versions are 8.5.12, 8.4.27, 8.3.36 and 8.2.35. CISA added both to its list of exploited vulnerabilities five days later.
All year: the plugins. Patchstack counted 11,334 new vulnerabilities in the WordPress ecosystem in 2025, 42% more than the year before, and measured the median time to mass exploitation of the heavily targeted ones at five hours.
The detail that matters most is in the first item. Searchlight says the WordPress flaw was found with an AI model in about ten hours, for about $25 of compute. Finding serious bugs used to need rare people and months. It now needs an afternoon and a card. The number of flaws in old code has not changed. The cost of finding them has collapsed, and the window between a patch and an attack is now measured in hours.
What this does not prove
It does not prove PHP is uniquely broken, and anyone who tells you their stack is immune is selling something. In December 2025 the same kind of flaw, an unauthenticated remote code execution, was disclosed in React Server Components, and it reached Next.js applications. Every stack will have its bad week.
What differs is how much of a site is exposed when that week comes, and how fast it can be closed.
A typical WordPress site runs PHP on every visitor request. Its login page is at an address every scanner knows. Its database sits next to it. And it often carries dozens of plugins, each written by a different author, each with its own update schedule, any one of which is enough.
A typical Next.js site serves most pages as files built in advance, from a CDN. There is no public admin panel. The database, if there is one, is not reachable from the internet. Every dependency is pinned in a lock file that can be audited by a machine, and a patch is a version bump and a redeploy that can be rolled back in a minute.
That is the real argument: not fewer bugs, but less surface and a shorter distance between "a fix exists" and "the fix is live".
Why Next.js is the usual replacement
SEO is built in rather than bolted on. Pages arrive as complete HTML. Titles, canonicals, sitemaps and structured data are code, reviewed like any other code, not settings spread across three plugins.
Speed is available. Static generation, image optimisation and code splitting come with the framework. Available is the honest word: a Next.js site buried under third-party scripts is slow too. The framework removes the excuses, not the work.
It is stable and widely known. It is React, which is the largest front-end hiring pool there is. That matters more than any feature, because the most expensive site is the one nobody wants to maintain.
It runs anywhere. Vercel, a container, your own server behind a proxy.
The cost is equally plain. There is no plugin marketplace. A feature that was one click in WordPress is a ticket for a developer. If your team changes the site daily and has no developer within reach, that trade needs thinking about before the migration, not after.
Two ways to do it
| Full replacement | Headless WordPress | |
|---|---|---|
| Where content is edited | A new CMS, or files in the repository | The WordPress admin the team already knows |
| What visitors touch | Next.js only | Next.js only |
| Is PHP still running | No | Yes, but only for editors |
| Retraining | Yes | Almost none |
| Best for | Small teams, developer-led content | Large content teams, years of posts |
Headless is the option people overlook. WordPress stays as an editing tool, moved to a separate address that visitors never reach, and Next.js reads from it at build time. It is not a way out of patching: that WordPress still runs PHP and still has to be updated the day a fix ships. But the public site no longer depends on it, the plugin count drops to a handful, and access can be restricted to the people who edit.
What we moved for Corporate Stays
Corporate Stays rents furnished corporate housing from Montreal across Canada and Latin America. The old site was WordPress, with French and Spanish served by a translation plugin.
The new one is a full redesign on the Next.js App Router, in three languages, with about 2,900 URLs in the sitemap. Apartment listings come live from the property management system rather than being copied into pages. The content and the data held in the old WordPress database were carried across. The CRM integrations, forms and chat included, were rebuilt on the new front end. The content team kept a WordPress editor, now headless and closed to anonymous requests.
The rebuild took about a month.
The parts that actually break
The page templates are the easy part. These are not.
URLs. Every old address needs a destination. On a large site, expect the first crawl to find dozens of old URLs with no redirect, and expect the language-prefixed versions to have been forgotten entirely. Compare the old sitemap against the new site by script, not by eye.
Translations. A plugin that translated pages on the fly leaves nothing to migrate. The new site needs real translated content, and a French page that shows English text is worse than no French page.
Page-builder markup. Shortcodes and builder blocks do not export as clean content. Someone has to map them to components, and whatever is not mapped shows up in production as a placeholder.
Forms and tracking. Every form, every CRM field mapping and every analytics tag has to be rebuilt and then tested with a real submission. The old site did this through plugins nobody remembers configuring.
Legal pages. Privacy, cookies and terms are linked from every footer and checkout, and they are the pages most often missing a week before launch.
How it fits in a month
A rebuild of this size used to be a quarter. Two things changed that.
AI-assisted development removes most of the typing: converting templates, writing redirect maps, porting content. It does not remove the review, and the data on AI-generated code is clear about what happens when it is skipped.
And a structured QA pass replaces opinion with a list. A pre-launch crawl of every URL, in every language, against the old site is what turns "it looks finished" into a ranked set of blockers. That is the same method as our website audit, run before launch instead of after.
Should you move now
Not necessarily. A small brochure site with a few well-known plugins, on managed hosting that applies updates the same day, is a defensible position. Whatever you decide, check today that the server is on a patched PHP version. That part is not optional.
Move when the site earns money and an outage is a business event, when the plugin list is long and nobody can say what half of them do, when the theme was custom-built by someone who has left, or when a redesign is due anyway. In the last case you are paying for most of a rebuild regardless.
This is the work on our custom development page. If you want a straight answer about your own site, send us the address and we will tell you whether it is worth moving or only worth patching.