
Headless CMS
What Is Headless WordPress and Should You Use It?
Learn how Headless WordPress works, compare REST and WPGraphQL, understand performance, workflows, costs and when a unified platform makes sense for your team.
Build a headless WordPress site with Next.js, WPGraphQL and modern hosting. Learn setup steps, trade-offs, real examples and deployment best practices.
This playbook is designed for developers, architects and technical decision-makers who want a clear, end-to-end understanding of a decoupled or headless WordPress setup – from foundational concepts to real-world deployment considerations. We’ll break down how decoupled WordPress works, how to set it up correctly, the trade-offs you should evaluate and how leading brands are using it in production today.
Decoupled (or headless) WordPress is a modern way of using WordPress where content management and website presentation are separated into two independent layers.
In a traditional WordPress site, WordPress does everything. It stores content and renders the final HTML using PHP themes. When a visitor loads a page, WordPress handles the request end-to-end – querying the database, running PHP templates and returning a fully rendered page.

With decoupled/headless WordPress, this tight coupling is loosened. WordPress continues to manage content in the familiar admin dashboard, but some or all of the presentation logic moves elsewhere. Content is exposed via APIs and other systems – JavaScript frontends, search services or interactive components – can fetch that content as structured data instead of relying entirely on WordPress themes.
However, there is a subtle distinction that’s important to understand. Decoupled WordPress is the broader concept. The backend and frontend are separated to some degree, but WordPress may still render parts of the site. For example, a site might use a traditional WordPress theme for most pages while powering search, filtering or interactive features through API-driven JavaScript. These hybrid approaches are common during gradual migrations.
Headless WordPress is a specific type of decoupled architecture where the separation is complete. WordPress no longer controls page rendering at all. It acts purely as a backend content system, exposing data through the REST API or GraphQL. A separate frontend application – built with frameworks like Next.js or React – is fully responsible for routing, rendering HTML and delivering the user experience.
Nonetheless, in a headless setup, visitors never interact with WordPress directly. The frontend receives the request, fetches content from WordPress as JSON and renders pages using static generation, server-side rendering or a hybrid approach. This gives teams full control over performance, design and delivery strategies.
This architectural separation is what enables the speed, flexibility and multi-platform delivery that modern organizations increasingly require.
The first decision is hosting. Your host needs to support clean routing, modern PHP versions, HTTPS and predictable performance for API traffic.
After this:
Even in an API-only setup, WordPress relies on its routing system to expose endpoints like GraphQL. By default, WordPress may use Plain permalinks, which generate URLs such as:
?p=123
This causes problems in headless architectures. APIs like GraphQL are better exposed through clean, path-based URLs, for example:
/graphql
Plain permalinks can force GraphQL into query-string endpoints, which may break caching, proxies or frontend frameworks like React and Next.js.
To fix this, go to Settings > Permalinks in the WordPress admin and choose any option except Plain. The Post name option is recommended because it is widely supported and predictable. After saving, WordPress regenerates its rewrite rules, allowing GraphQL to register a clean endpoint.
If you see 404 errors afterward, simply re-save the permalinks or verify that your server supports WordPress rewrite rules. Once this step is complete, your WordPress site is ready to safely expose a /graphql endpoint for your headless frontend.
WPGraphQL fundamentally changes how WordPress exposes its content by providing a strongly typed GraphQL schema that represents posts, pages, users, media, taxonomies and custom content types. Instead of making multiple REST requests or receiving more data than you need, GraphQL allows your frontend to request exactly the fields it requires in a single query.
To get started:
https://your-site.com/graphql
If everything is configured correctly, you will not see a typical webpage. Instead, you’ll see a mostly blank screen or a minimal message. This is expected. GraphQL endpoints are not meant to render HTML; they exist solely to accept queries from clients like your frontend app. Seeing anything other than a 404 or server error is a good sign.
query Test {
generalSettings {
title
url
}
posts(first: 5) {
nodes {
id
title
slug
}
}
}
When you execute the query, you should immediately see structured JSON data returned in the response panel. This confirms that WordPress routing is working, WPGraphQL is active and your site’s content is accessible through GraphQL.
The frontend is your real website, rendering pages, handling routing and deciding what data to request from WordPress. You can do this with plain React, but Next.js is usually the better default because it supports server rendering, static generation, caching and SEO-friendly output out of the box.
Next.js is a Node.js application that runs locally during development and gets deployed separately later.
On your development machine:
npx create-next-app@latest my-headless-site
cd my-headless-site
npm install @apollo/client graphql @apollo/client-integration-nextjs
The first line downloads and scaffolds a brand-new Next.js project into a folder named my-headless-site. The second line moves your terminal into that new folder so you can run commands inside the project. The third line installs Apollo Client and GraphQL dependencies so the Next.js app can fetch and render data from a GraphQL API. Apollo Client is optional. If you prefer a lighter setup, Next.js can query a GraphQL endpoint using the native fetch() API. Apollo is used here to simplify caching, state management and data reuse across components.
npm run dev
When it starts successfully, your terminal will print a local URL – usually http://localhost:3000. Open that URL in your browser and you should see the default Next.js starter page running locally.
WORDPRESS_GRAPHQL_ENDPOINT=https://YOUR-WP-DOMAIN.com/graphql
The fetchGraphQL helper is a simple function that sends a POST request to your WordPress GraphQL endpoint, includes your GraphQL query in JSON ({ "query": "..." }) and returns the parsed JSON response.
Open the app/page.tsx file in your Next.js project and add the following code (if code already exists, replace it with the following):
export const revalidate = 0; // disable caching while testing
async function fetchGraphQL(query: string) {
const endpoint = process.env.WORDPRESS_GRAPHQL_ENDPOINT;
if (!endpoint)
throw new Error("Set WORDPRESS_GRAPHQL_ENDPOINT in .env.local");
const res = await fetch(endpoint, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query }),
cache: "no-store",
});
const json = await res.json();
if (!res.ok || json.errors) {
throw new Error(JSON.stringify(json.errors ?? json, null, 2));
}
return json.data;
}
export default async function Home() {
const data = await fetchGraphQL(`
query {
posts(first: 5) {
nodes { title slug }
}
}
`);
const posts = data?.posts?.nodes ?? [];
return (
<ul>
{posts.map((p: any) => (
<li key={p.slug}>{p.title}</li>
))}
</ul>
);
}
This page is a minimal server-rendered Next.js page that proves your WordPress site is working as a headless CMS via WPGraphQL. When the page is requested, Next.js runs the code on the server, fetches content from WordPress using GraphQL and renders the result directly into HTML before sending it to the browser.
Here’s how this happens:
Once the data is returned, the code safely extracts the list of posts. If no posts are available or something is missing, it falls back to an empty array instead of crashing the page. The component then renders a basic unordered list, looping over the posts and displaying each title. If the titles appear in the browser, it confirms that WordPress, WPGraphQL and Next.js are successfully connected in a headless setup.
At this point, the core headless connection is complete. Your Next.js frontend can successfully fetch and render content from WordPress using WPGraphQL. Of course, this is only a minimal implementation. Everything beyond this is up to you and your needs: you can add dynamic routes for individual posts, build page templates, integrate a design system, introduce caching and revalidation or connect additional WordPress data such as menus, custom fields or blocks.
To deploy the Next.js app, push your project to a Git repository (for example, GitHub). Then connect that repository to a hosting platform that supports Next.js, such as Vercel. During setup, configure the same environment variable used locally (WORDPRESS_GRAPHQL_ENDPOINT) in the hosting provider’s environment settings, pointing it to your production WordPress /graphql endpoint.
Once deployed, the hosting platform will build your Next.js app, run the same GraphQL queries against your live WordPress site and serve the rendered pages globally. If the post titles appear on your deployed site just as they did locally, your headless WordPress site is now live. From here, you can iterate freely on frontend features without touching WordPress, which is the core advantage of going headless.
If you’re using Pantheon, your WordPress decoupled setup will have a clean three-layer model, which represents Pantheon’s long-term direction for decoupled frontends.
Layer one is the WordPress backend (CMS), which will run on Pantheon and will be used purely for content management. Layer two is the Next.js frontend (presentation layer), also hosted on Pantheon (currently in private beta, so access requires approval). Tying everything together is the third layer, which is Pantheon’s infrastructure. Pantheon provides:
As you can see, Pantheon provides a tightly integrated environment that scales operationally as well as technically.
The most immediate benefits of decoupled sites include:
However, there are some drawbacks to decoupled sites, like increased complexity and greater developer dependency.
You are effectively running two systems: a CMS backend and a frontend application. This requires more planning, stronger technical discipline and teams skilled in modern frontend development.
Also, many features that come “for free” in traditional WordPress – forms, search, comments, previews, SEO tooling – must be custom-built or integrated with third-party services. This can create bottlenecks where marketing teams rely heavily on developers for changes.
The content editing experience can suffer if preview workflows are not carefully implemented. Editors no longer see exactly how content will appear by default, which can slow publishing and increase back-and-forth unless preview solutions are built intentionally.
Decoupled sites are ideal when performance, scalability and multi-channel delivery are business-critical. They are less suitable for small, simple websites, teams with limited development resources or projects that rely heavily on traditional WordPress plugins.
Al Jazeera is a well-known enterprise example of decoupled WordPress in production. Their decoupled approach is often framed as a “create once, publish everywhere” model: centralize content in WordPress, then distribute it to different digital experiences from the same source of truth. This decoupled architecture allows Al Jazeera to scale globally, support high-velocity editorial workflows and deliver content across web, mobile and emerging channels without duplicating CMS logic.
TechCrunch adopted a similar approach when it rebuilt its platform around a decoupled WordPress backend and a React-based single-page application. Instead of serving pages directly from WordPress, the site pulls JSON from the WordPress REST API and renders content in a fast, app-like frontend. This eliminated full page reloads, enabled richer interactions and allowed TechCrunch’s small engineering team to evolve the user experience without disrupting editorial workflows.
Decoupled WordPress has matured into a proven architecture for teams that need performance, scalability and long-term flexibility. By separating content management from presentation, organizations unlock faster load times, stronger security, independent scaling and true omnichannel delivery – all while keeping WordPress as the editorial engine teams already trust.
But architecture alone isn’t enough. Decoupled success depends on the platform running it.
That’s where Pantheon stands out. With first-class WordPress hosting, a modern Next.js frontend platform, a global CDN, built-in security and a unified dashboard, Pantheon removes the operational friction that often makes decoupled setups hard to manage. Instead of stitching together multiple vendors, teams get a single, enterprise-ready foundation designed specifically for decoupled sites.
If you’re serious about building a future-proof decoupled WordPress setup – one that scales with traffic, teams and technology – Pantheon gives you the infrastructure, workflows and reliability to do it right.

Headless CMS
Learn how Headless WordPress works, compare REST and WPGraphQL, understand performance, workflows, costs and when a unified platform makes sense for your team.

Headless CMS
Planning a headless WordPress build? Learn how to choose the right API, rendering strategy, caching, previews and hosting from the start.

Headless CMS
Headless WordPress promises speed and flexibility. Learn what you gain, what you lose and how to decide if it's the right architecture for your project.