← All posts

Headless WordPress (Next.js, Astro…): is it a good idea for your website? A guide to deciding

An agency is pitching headless WordPress with a Next.js or Astro front end? What you actually gain, what you give up, where the budget and maintenance go, and the questions to ask before you sign.

Headless WordPress (Next.js, Astro…): is it a good idea for your website? A guide to deciding

Key points

  • Headless WordPress is used only as a back office: the public site is a separate application (Next.js, Astro, Nuxt…) that pulls content through the REST API or GraphQL.
  • It pays off when content feeds several channels or the front end is really an application; for a brochure site or a blog, a well-built classic WordPress site does just as well, for less.
  • The hidden cost is everything plugins used to do on the public side (SEO, forms, previews, redirects…), which now has to be rebuilt and then maintained across two projects.

“Headless”, “Jamstack”, “decoupled”: over the last few years these words have crept into almost every redesign proposal. Clients regularly forward us quotes that keep WordPress for editing but build the public site in a JavaScript framework, promising something faster, safer and more modern. Sometimes that’s exactly the right call. Often it’s a heavier architecture than the project needs, and the maintenance bill shows up later. We build both kinds of site, and we’ve also taken over headless projects whose owners wanted to move back to classic WordPress. Here’s what we’ve learned, so you can decide with your eyes open, along with enough technical detail to understand what’s going on under the hood.

What “headless” actually means

A classic WordPress site does two jobs at once. It stores and manages content (the admin, the editor, media, users) and it builds the pages visitors see, through the theme. Both live on the same server, in the same codebase.

Headless cuts off the “head”, meaning the theme. WordPress is used only to write and organise content. The public site is a separate application, usually built with Next.js, Astro or Nuxt and hosted elsewhere, which fetches posts and pages from WordPress through an API: either the REST API built into WordPress (the /wp-json/ URLs) or GraphQL via the WPGraphQL plugin.

In practice you end up with two projects instead of one:

  • the CMS: a WordPress install on a subdomain such as cms.yoursite.com, which your team uses as before;
  • the front end: the JavaScript application that renders pages, deployed on suitable hosting (a platform like Vercel or Netlify, or a Node server);
  • the glue: the API calls, how the front end finds out content has changed, and how previews work.

There are two broad ways to produce pages on the front end. Either they’re generated ahead of time and served as static files, then rebuilt when content changes, or they’re rendered on demand by the front-end server, behind a cache. That choice directly affects how fresh content is and how complex the setup gets; more on that below.

What you genuinely gain

The benefits are real, but narrower than the sales decks suggest. These are the ones we’ve actually seen on live projects.

One body of content, many channels. This is the strongest argument. If the same content has to feed a website, a mobile app, in-store screens, a newsletter or a partner’s site, a clean API is the right architecture. WordPress becomes one data source among others, and each channel displays what it needs.

A front end that’s really an application. Customer portal, product configurator, dashboard, highly interactive faceted search: when most of the site is an application interface and editorial content is only part of it, a JavaScript framework is more at home than a WordPress theme. Going headless lets your team keep writing in a tool they already know.

A smaller public attack surface. Visitors never touch WordPress directly. The admin can sit behind an IP allowlist or a VPN, and the usual vulnerabilities in plugins that output public HTML disappear along with the theme. Don’t overstate this, though: the CMS is still a WordPress site that needs updating, and the API is still exposed.

Performance is the most quoted argument and the least decisive. A well-built static front end is very fast, true. But a classic WordPress site with a lean theme, page caching and properly sized images also gets excellent Core Web Vitals. In our audits, slow WordPress sites are nearly always slow because of a heavy page builder, a pile of plugins or undersized hosting, not because WordPress renders the pages. Changing architecture to fix a theme problem is like moving house to replace the sofa.

What you give up (and what the quote rarely mentions)

On a classic WordPress site, much of the public site is produced by plugins. Go headless and anything that outputs HTML or acts on public pages stops working as is. This is what derails budgets most often, because it only surfaces mid-project.

  • SEO: Yoast or Rank Math still compute titles, descriptions and structured data, but the front end has to fetch them (the yoast_head_json field in the API, for example) and output them. The XML sitemap, canonical tags and robots.txt have to be rebuilt on the front end.
  • Redirects managed by a WordPress plugin no longer apply to visitors: they have to be exported to the front end or its host, and that sync kept alive every time someone adds one.
  • Forms (Contact Form 7, Gravity Forms…): rendering has to be redone, submissions go through the plugin’s API where one exists, and spam protection needs rewiring.
  • Previews: the Preview button opens the CMS domain, which no longer shows anything. The front end needs an authenticated preview mode that can read drafts.
  • Block rendering: the API returns Gutenberg block HTML, but block styles, scripts for interactive blocks and blocks added by plugins all have to be handled by the front end. A block added by a plugin can suddenly appear unstyled.
  • Multilingual, search, comments, WooCommerce: all of them work headless, but each needs its own integration. A headless WooCommerce store (cart, checkout, customer account) is a project in its own right.

There’s a less technical loss too: autonomy. On classic WordPress, a confident user can install a plugin and see the result on the site. Headless, almost every visible change needs a front-end developer. If your marketing team is used to moving on its own, that’s a change in how you work, and worth planning for.

Budget and maintenance: where the time and money go

We won’t give generic figures; they depend too much on scope. The cost items, though, are always the same, and it’s easy to check that a quote covers them.

  • Two projects to build: WordPress (content types, fields, roles, API) and the front end (templates, components, routing). Some of the work a classic theme would need simply moves; some is added on top, namely the layer that connects the two.
  • Rebuilt features, as listed above: SEO, redirects, forms, previews, sitemap. Each is a small job; together they aren’t.
  • Two hosting bills: one for WordPress, one for the front end. Some platforms bill on usage (compute time, bandwidth, team seats): get an estimate based on your real traffic, not the free tier.
  • Two maintenance tracks: WordPress and plugin updates carry on, and the JavaScript framework and its dependencies are added on top. Front-end frameworks move fast; a major version can take days of work. A front end left without updates for two years becomes hard to change at all.
  • Skills: you need someone comfortable with WordPress and someone comfortable with the chosen framework. The day you change agencies, there are fewer people able to take over a custom headless build than a WordPress theme.

On the projects we’ve inherited, the problem was never the build cost, which the client had signed off. It was maintenance: a front end nobody had updated, redirects added in WordPress that did nothing, a preview broken for months that editors worked around by publishing and fixing things live. So ask what the maintenance contract covers for the front end, not just for WordPress.

Under the hood: what a headless front end looks like

Seeing the mechanics helps you judge a proposal. On the front end, fetching posts means querying the WordPress REST API. The _embed parameter saves an extra request per image and per author:

// lib/wordpress.js : the 10 latest published posts, with featured image and author
const API = 'https://cms.example.com/wp-json/wp/v2';

export async function latestPosts() {
  const res = await fetch(`${API}/posts?per_page=10&_embed=wp:featuredmedia,author`);
  if (!res.ok) throw new Error(`WordPress API: ${res.status}`);

  const posts = await res.json();
  return posts.map((p) => ({
    slug: p.slug,
    title: p.title.rendered,       // HTML already escaped by WordPress
    excerpt: p.excerpt.rendered,
    date: p.date,
    image: p._embedded?.['wp:featuredmedia']?.[0]?.source_url ?? null,
    author: p._embedded?.author?.[0]?.name ?? '',
  }));
}

That code is simple; what surrounds it is less so. If pages are generated ahead of time, the front end needs to know when content changes. The usual approach is a webhook: WordPress calls a front-end URL on every publish, and the front end rebuilds that page. On the WordPress side, a small must-use plugin is enough:

<?php
// wp-content/mu-plugins/front-revalidation.php
// Tells the front end when published content changes, so it rebuilds the affected page.
// FRONT_REVALIDATE_URL and FRONT_REVALIDATE_SECRET are defined in wp-config.php.

add_action( 'wp_after_insert_post', function ( $post_id, $post, $update, $post_before ) {
    $was_published = $post_before && 'publish' === $post_before->post_status;

    // Editing a draft changes nothing publicly.
    if ( 'publish' !== $post->post_status && ! $was_published ) {
        return;
    }
    if ( wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id ) ) {
        return;
    }

    wp_remote_post( FRONT_REVALIDATE_URL, [
        'timeout'  => 5,
        'blocking' => false, // don't make the editor wait
        'headers'  => [
            'Content-Type'        => 'application/json',
            'X-Revalidate-Secret' => FRONT_REVALIDATE_SECRET,
        ],
        'body'     => wp_json_encode( [
            'type' => $post->post_type,
            'slug' => $post->post_name,
            // the previous slug, so a renamed page's old URL gets purged too
            'previous_slug' => $post_before ? $post_before->post_name : null,
        ] ),
    ] );
}, 10, 4 );

We use wp_after_insert_post rather than save_post because it fires after categories and custom fields have been saved: with save_post, the front end sometimes rebuilt the page with stale metadata. And we send the previous slug: without it, a renamed page lives on at its old URL in the front-end cache. The shared secret stops anyone from triggering rebuilds at will.

One last detail missing on nearly every inherited project: the CMS domain keeps showing the old theme, and Google indexes it as a duplicate of the real site. A 301 redirect on the template_redirect hook, which admin, API and media requests never reach, sends those visits to the front end.

Then there are internal links: in the content, links and images point to cms.yoursite.com. The front end has to rewrite those URLs, and media should be served from a domain or CDN you control, otherwise the CMS becomes a bottleneck for every single image.

The traps we run into most often

  • Content that doesn’t update. The webhook fails silently (secret changed, front end redeployed elsewhere) and pages stay frozen. You need a log of webhook calls and a simple way to force a full rebuild.
  • Build times that balloon. Rebuilding every page on every edit is fine with fifty pages, far less so with several thousand. Targeted, page-by-page rebuilds have to be planned from day one.
  • An API that says too much. By default, the REST API exposes the user list and other details. Restrict what’s public and protect sensitive endpoints. WordPress application passwords are a sound basis for authenticating the front end when it needs to read drafts.
  • Empty pages for Google. If the front end only renders content after JavaScript runs in the browser, indexing becomes slower and more fragile. Pages should be rendered on the server or ahead of time, which the frameworks mentioned can all do, provided it’s configured.
  • Lost editors. No reliable preview, blocks that look different in the editor and on the site: that’s the number one reason behind the rollbacks we’ve seen. Test previews with the editors before launch, not after.

How to decide (and the alternatives worth considering)

These are the questions we ask in workshops. If the answer to all of them is no, a well-built classic WordPress site will almost always be simpler, cheaper and give your team more autonomy.

  • Does your content need to feed channels other than a website (mobile app, partners, screens)?
  • Is the core of the site an application interface rather than a set of pages?
  • Do you have, in-house or through your agency, lasting front-end skills to maintain the application over time?
  • Does the budget cover rebuilding SEO, forms, previews and redirects, plus maintaining two projects?

Between the two extremes there are middle paths we often recommend. A lean custom theme with no page builder fixes most speed problems. Partial headless: the site stays classic and only the application part (a customer area, a calculator) is a separate app reading the WordPress API. A static export of WordPress, for sites that rarely change and need to withstand heavy traffic, with fewer moving parts than full headless.

Finally, if you’re offered headless, ask for three things in writing: how previews work, what happens when you add a redirect or a plugin, and who updates the front end, and how often. The answers will tell you whether the architecture was designed to last or just to launch.

FAQ

Is a headless site always faster?

No. A well-built static front end is very fast, but a poorly optimised headless front end (unsized images, heavy JavaScript, API calls on every visit) can be slower than classic WordPress with caching. Speed comes from how the site is built, not from the architecture.

Will our editors have to change how they work?

The admin looks the same. What changes: previews, which have to be rebuilt; a possible delay between publishing and the site updating; and new visual plugins no longer showing up on the public site automatically.

Can we move from classic WordPress to headless later?

Yes, and it’s often the wisest path: content stays in WordPress and only the presentation layer changes. Structuring content properly now (content types and custom fields rather than layout baked into the editor) makes that move much easier.

And going back from headless to classic WordPress?

It’s doable, since the content already lives in WordPress. You need a theme that reproduces the design, the public-facing plugin features switched back on (SEO, forms, redirects) and the front end’s URLs preserved so you don’t lose rankings.

Torn between classic and headless WordPress, or puzzled by a quote? We look at what you actually need, recommend the simplest architecture that delivers it, then build and maintain it.

Share LinkedIn Facebook X WhatsApp
</>

webtestudio

Web agency: custom WordPress sites, premium themes and SaaS software.

Discuss your project →