Skip to content

Headless WordPress Migration for a News Site with 9,649 Articles

Adityo Guni Waluyo

Census first: 9,649 published posts read before the design. An Astro 5 output correction, REST extraction, and a two-pass delta keep the news site serving.

TL;DR

Census before design proved decisive: the database revealed 9,649 posts publishing at 170–380 monthly, reshaping the whole migration plan. Astro 5 dropped hybrid output, so pages prerender by default while single posts use prerender=false to stay on-demand. The clean WordPress stack serves content via REST API, with a two-pass delta sync and 301 redirects guaranteeing zero-downtime cutover.

When I ran the first census query directly from the production database, the numbers on the screen immediately shifted my initial assumptions. The database showed exactly 9,649 published posts, with an active publishing cadence of 170 to 380 posts per month. More strikingly, there were already 22 new posts in just the first two days of December. This was not just administrative statistics; it was the primary determinant of how the migration pipeline had to be designed to avoid halting a newsroom that never stops publishing.

The initial migration plan assumed the use of the output: 'hybrid' configuration based on familiar Astro version 4 documentation. That assumption survived until a re-check of the official Astro 5 upgrade guide revealed a different reality.

Census first, design second

The migration complexity lay not in deep plugin customization, but in high daily volume and historical data accumulation. The database census revealed critical details: 14,529 post revisions (decided against migrating to keep the new database clean), 6,439 attachments, and a total media size of 8.2 GB. The content infrastructure also included 63 Elementor templates, 16 tracking snippets (Google Analytics 4 plus header/footer scripts), 3 active users, 1 Advanced Custom Fields group, 9 custom post type entries, and only 1 approved comment.

The most critical finding emerged when checking the server configuration. The configuration file nominally named CMS was not a separate subdomain as previously assumed. In fact, it was a full WordPress installation running on a non-public port behind the front nginx proxy. A configuration file name is not architecture documentation; one direct read prevented a wrong design.

Astro 5 removed the hybrid output option

The plan assumed output: 'hybrid' because that pattern fits a news site: archive pages prerendered, single posts rendered on demand. The official Astro 5 upgrade guide states that the hybrid and static configurations merged into a single static configuration that behaves like the old hybrid mode [1]. The new pattern: all pages are prerendered at build time by default [2], and any route requiring server rendering adds export const prerender = false [2].

For a news site this means the home page and category pages stay static, while single posts render on request, so new posts appear without waiting for a full rebuild. This correction also closes the purely static Astro option. If every new post required a full site rebuild, a cadence of 170 to 380 posts per month would turn publishing into a deliberate outage window.

Content via REST, not raw Elementor data

Three migration approaches were evaluated. The 1:1 clone copies the old WordPress with all plugins into new containers; fastest, but it couples the frontend to Elementor markup permanently. Purely static Astro is the second option, already rejected above. The chosen approach: a fresh, clean WordPress installation without Elementor or WP Rocket, content curated into native Gutenberg blocks, and the Astro frontend reading data via the WP REST API.

The extraction source is rendered HTML from the REST API response, not the fragile raw _elementor_data structure. The posts endpoint documentation explains that the context parameter determines which fields are present in the response, with the default view context [3]. This was verified directly against the WordPress.org news API, which returns complete HTML inside the content.rendered property [4]. Extracted HTML is then converted to Gutenberg blocks; tables and embeds become classic HTML blocks.

URL parity is the final gate: a 301 redirect map for every old URL, followed by a parity crawl ensuring every old URL answers HTTP 200 with a matching title. The new sitemap is generated only after the crawl passes.

Two-pass delta on cutover day

The cadence of 170 to 380 posts per month guarantees content drift between the initial snapshot and the actual cutover day. The delta pass is therefore a core part of the migration design, not an add-on. The first pass re-extracts every post published or updated after the snapshot timestamp, directly from the live REST API. The second, smaller micro-delta closes the gap that opens while the first pass is running.

The old site keeps serving readers until parity is fully verified; no publishing freeze lasts more than a few minutes. The admin panel and CMS REST endpoints are never public. They stay on an internal route behind the front nginx proxy with authentication, and media moves to a dedicated assets subdomain with the 301 map covering old main-domain paths.

What changed most from the original plan was not the choice of framework but the order of operations: census first, then technical design. The reality of 22 new posts in two days shaped this migration pipeline more decisively than any technology consideration.

Sources

  1. Upgrade to Astro v5, Astro Docs
  2. On-demand rendering, Astro Docs
  3. Posts, WordPress REST API Handbook
  4. WordPress.org News REST API (live response, December 2026)

Related articles