Last updated: September 2026 · Reading time: 14 min · By the Best Web Developer team
Quick answer
Headless WordPress means using WordPress only as the content editor and API, while a separate Next.js app renders the public site. To build it, install WPGraphQL (or use the REST API), create a Next.js App Router project, fetch content with incremental revalidation, add previews and on-demand revalidation, map SEO fields, then deploy the front end and lock down the WordPress install.
Key takeaways
- Headless WordPress suits content-heavy, high-traffic or multi-channel sites; a normal WordPress theme is still better for small brochure sites.
- WPGraphQL plus the Next.js App Router with incremental static regeneration is the most common and reliable stack in 2027.
- Previews, on-demand revalidation and SEO metadata are the three pieces most tutorials skip and most projects struggle with.
- Typical budgets run from SAR 45,000–90,000 for a bilingual marketing site to SAR 150,000–400,000 for large publishing or commerce builds.
- For Saudi sites, plan Arabic RTL layouts, hreflang and data hosting from the start, because retrofitting them in a headless build is expensive.
What headless WordPress is and when it makes sense
Headless WordPress separates content management from presentation: editors keep the familiar WordPress dashboard, and a Next.js app builds the pages visitors see. It makes sense when speed, security or multi-channel publishing matter more than plugin convenience.
Headless WordPress is a setup where WordPress stores and manages content but does not render the public website; content is delivered through an API to another application. Next.js is a React framework that renders pages on the server or at build time, with built-in routing, caching and image optimisation.
Highlight: the short rule for going headless
We use this architecture for clients who publish a lot, run campaigns with sharp traffic spikes, or need the same content in a website, an app and other channels. For a ten-page company site, a well-built classic theme is usually cheaper and just as fast.
Note: who this guide is for
This is a practical build guide for technical leads and developers, with decision points explained for business owners. It describes the architecture and steps in plain language rather than full code listings, so you can plan the project, brief a team or check a proposal.
Headless WordPress architecture: the moving parts
A headless WordPress build has four parts: the WordPress back end, an API layer, the Next.js front end, and hosting with caching. Each has choices that affect cost, speed and editor experience.
The WordPress back end
WordPress runs on its own subdomain, such as cms.example.com, with the admin protected and the public theme disabled or redirected. Custom post types and fields (usually Advanced Custom Fields) model your content: services, locations, team, case studies, products. Keep plugins to a minimum; anything that only changes the front-end theme is now irrelevant.
The API layer: WPGraphQL or REST
WordPress ships with a REST API at the wp-json path. WPGraphQL is a free plugin that adds a GraphQL endpoint, so the front end can request exactly the fields it needs in one query. We default to WPGraphQL for sites with many content types and relationships, and use REST for small builds or where a plugin exposes only REST data.
The Next.js front end
The front end is a Next.js project using the App Router. Pages are React server components that fetch content at build time or on request, then cache it. Read the official Next.js documentation on data fetching and caching before you design your routes, because caching decisions shape the whole build.
Hosting and caching
The Next.js app runs on a platform such as Vercel, a Node server, or an edge platform like Cloudflare. WordPress runs on standard PHP hosting. A CDN in front of both keeps pages fast for visitors in Riyadh, Jeddah and abroad.
Step by step: building headless WordPress with Next.js
Follow ten steps in order: model content, expose the API, scaffold Next.js, write a data layer, build routes, set revalidation, add on-demand revalidation, enable previews, map SEO, then deploy and lock down. Skipping previews or revalidation is the most common cause of unhappy editors.
- Model the content in WordPress. Create custom post types and field groups for every template. Name fields clearly, because the front-end team will query them by name.
- Install and configure WPGraphQL. Add WPGraphQL, plus the extensions for your fields and SEO plugin. Expose only the post types and fields the front end needs, and test queries in the built-in GraphiQL IDE.
- Create the Next.js project. Use the App Router, TypeScript and a single environment variable holding the GraphQL endpoint URL.
- Write a small data layer. One helper function sends queries to WordPress, sets a cache lifetime and attaches cache tags such as “post” or “page” to each request.
- Build dynamic routes. A route like blog/[slug] fetches one post by slug. Use generateStaticParams to pre-build the most important pages at deploy time, and let the rest render on first request.
- Set incremental revalidation. Give each fetch a revalidate time, for example 300 seconds for blog posts, so pages refresh without a full rebuild.
- Add on-demand revalidation. Create a secret-protected API route in Next.js that calls revalidateTag or revalidatePath. In WordPress, trigger it with a webhook when a post is saved, so published changes appear within seconds.
- Enable previews. Use Next.js Draft Mode and a preview link from WordPress so editors can see unpublished drafts on the real front end, authenticated with an application password.
- Map SEO data. Pull titles, meta descriptions, canonical URLs, Open Graph images and schema from Yoast or Rank Math into the Next.js generateMetadata function. Generate sitemap and robots files in Next.js, not WordPress.
- Deploy and lock down. Deploy the front end, point the main domain to it, restrict the WordPress front end, rate-limit the API and keep WordPress on a separate, hardened host.
Pro tip
Generate your robots file with our free robots.txt generator, then serve it from Next.js on the main domain. Add a separate robots file on the CMS subdomain that blocks all crawling, so Google never indexes cms.example.com as a duplicate of your real site.
Headless WordPress details most tutorials skip
The hard parts of headless WordPress are not fetching posts; they are images, multilingual content, forms, redirects and search. Plan each one before you start building.
Images and performance
Configure the Next.js image component with remote patterns for your WordPress media domain, and request the right sizes from WordPress. Aim for Largest Contentful Paint at or under 2.5 seconds on mobile, as Google’s LCP guidance recommends. Headless sites often hit 1.2–1.8 s LCP when images are handled properly.
Arabic, English and RTL
Use Polylang or WPML with their WPGraphQL extensions to expose translations. In Next.js, create a locale segment such as /ar and /en, set the html lang and dir attributes per locale, and mirror layouts with CSS logical properties. Output hreflang tags for every translated pair.
Forms, search and redirects
Forms need a destination: Gravity Forms or Contact Form 7 via their APIs, or a Next.js route that sends to your CRM. Site search usually moves to a hosted search service or a custom endpoint. Export existing WordPress redirects into the Next.js configuration or middleware before launch, or you will lose rankings.
Highlight: the editor experience decides success
If editors cannot preview a draft, see changes quickly after publishing, or place a new block without a developer, they will ask to go back to a normal theme within months. Budget time for previews, revalidation and a sensible set of flexible content blocks.
Key benefits of headless WordPress with Next.js
Done well, headless WordPress gives you faster pages, a smaller attack surface and more freedom in design, while editors keep the WordPress dashboard they already know.
- Speed: pre-rendered pages served from a CDN routinely pass Core Web Vitals on mobile.
- Security: the public never touches WordPress directly, which removes the most common plugin and login attack routes.
- Scalability: static and cached pages handle Ramadan, White Friday or campaign spikes without scaling the WordPress server.
- Design freedom: the front end is plain React, not constrained by theme or page builder markup.
- Multi-channel content: the same API can feed a mobile app, kiosks or partner sites.
- Familiar editing: marketing teams keep using WordPress, custom fields and their existing workflow.
“Go headless for the reader and the editor, not for the developer’s portfolio. If neither gains, keep the classic theme.”
— Best Web Developer strategy team
Use cases for headless WordPress in Saudi Arabia
Headless WordPress suits Saudi organisations that publish heavily, face traffic spikes, or need very high security and bilingual performance. It is overkill for a small brochure site.
Media, publishing and government-facing content
News, magazine and knowledge portals publish many articles a day in Arabic and English. Headless builds keep them fast under load and simplify security reviews against NCA controls.
Real estate, tourism and events
Project launches, destination campaigns and ticketed events create sudden peaks. A pre-rendered Next.js front end absorbs those peaks while editors update listings and schedules in WordPress.
Brands running campaigns and apps
Retail and hospitality groups that run a website, an app and in-store screens can manage content once in WordPress and deliver it everywhere through the API.
Illustrative case: a Riyadh property developer moves to headless
Challenge: A Riyadh developer’s bilingual WordPress site with a page builder had a 4.6 s mobile LCP, crashed during two project launches, and had failed a security review because of outdated plugins.
What we did: We kept WordPress as the CMS, moved content into custom fields, and built a Next.js front end with WPGraphQL, Arabic-first RTL layouts, draft previews and on-demand revalidation. The build cost SAR 165,000 over 16 weeks.
Result: Mobile LCP fell to 1.6 s, the next launch handled about eight times normal traffic with no downtime, the plugin count fell from 41 to 12, and leads from the project pages rose 34% over the following quarter.
Headless WordPress vs classic WordPress vs other options
Classic WordPress is cheapest and simplest, headless WordPress is fastest and most flexible for content-heavy sites, and a headless SaaS CMS removes WordPress maintenance but changes the editor experience. The table shows the trade-offs.
| Option | Typical build (SAR) | Speed | Editor experience | Maintenance |
|---|---|---|---|---|
| Classic WordPress theme | 15,000–80,000 | Good if built well | Excellent, plugins work | Plugins, updates, security |
| Headless WordPress with Next.js | 45,000–400,000 | Excellent | Good, needs previews set up | Two systems to maintain |
| Headless SaaS CMS with Next.js | 60,000–450,000 | Excellent | Good, less familiar | Subscription fees |
| Website builder (Webflow, Wix) | 10,000–60,000 | Good | Very easy | Platform limits |
| Salla or Zid (commerce) | Monthly plan plus apps | Good | Easy | Limited customisation |
Monthly running costs for headless typically add SAR 400–2,500 for front-end hosting and CDN, on top of WordPress hosting. If you are unsure which route fits, our guide on choosing the right tech stack walks through the decision, and our WordPress development team builds both classic and headless sites. Gulf clients work with our Riyadh web design team for Arabic-first builds.
Our launch checklist for headless projects
- Every template has a working draft preview.
- Publishing triggers on-demand revalidation within 60 seconds.
- Titles, descriptions, canonicals, Open Graph and schema render in the page source.
- Sitemap, robots and hreflang are served from the Next.js domain.
- All old URLs redirect correctly, tested against a crawl of the old site.
- WordPress front end is blocked from indexing and the admin is restricted.
- Core Web Vitals pass on mobile for the top ten templates.
Headless WordPress trends to 2030 and Vision 2030
Vision 2030 is pushing Saudi organisations toward faster, more secure and more integrated digital services, which favours headless architectures for larger sites. Expect headless to become the default for enterprise WordPress in the Kingdom.
- Data residency: more organisations will host WordPress and APIs in Saudi cloud regions while serving the front end through a CDN.
- AI search: clean, structured content from custom fields makes it easier for Google AI features and chat assistants to understand and cite your pages.
- Edge rendering: more personalisation and A/B testing will run at the edge instead of on the WordPress server.
- Block-based content: better support for WordPress blocks in headless front ends will give editors more layout freedom.
- Security baselines: NCA controls and supplier questionnaires favour architectures that reduce the public attack surface.
Frequently Asked Questions about headless WordPress
What is headless WordPress?
Headless WordPress is a setup where WordPress manages content but does not render the public website. Content is delivered through the REST API or a GraphQL plugin such as WPGraphQL to a separate front end, often built with Next.js. Editors keep the familiar dashboard, while visitors get a faster, more secure site built with modern tools.
Is headless WordPress better for SEO?
It can be, mainly because pre-rendered pages load faster and pass Core Web Vitals more easily. But SEO only improves if the build outputs titles, meta descriptions, canonicals, schema, sitemaps, hreflang and redirects correctly. Many headless projects lose rankings at launch because these were forgotten, so treat SEO mapping as a required step, not an extra.
Should I use WPGraphQL or the REST API with Next.js?
WPGraphQL is usually the better choice for sites with many content types, custom fields and relationships, because one query returns exactly the data a page needs. The built-in REST API is fine for small sites or when a plugin only exposes REST data. Many projects use WPGraphQL for content and REST for a few plugin features.
How much does a headless WordPress site cost in Saudi Arabia?
Typical 2027 ranges are SAR 45,000–90,000 for a bilingual marketing site, SAR 90,000–180,000 for a content-heavy corporate or real estate site, and SAR 150,000–400,000 for large publishing or commerce builds. Running costs usually add SAR 400–2,500 a month for front-end hosting and CDN, on top of WordPress hosting and maintenance.
Do WordPress plugins still work in a headless setup?
Back-end plugins such as custom fields, SEO, translation and forms still work, often through WPGraphQL extensions or their APIs. Plugins that change only the front-end theme, such as page builders, sliders and caching plugins, no longer affect the public site. Check every plugin before you start and plan a Next.js replacement for any front-end feature you rely on.
How do previews work in headless WordPress?
Next.js Draft Mode lets editors view unpublished content on the real front end. WordPress sends the editor to a secret preview route with the post ID, Next.js turns on draft mode, and pages then fetch the latest draft through an authenticated API request. Without this setup, editors cannot check their work before publishing, which quickly causes frustration.
Is headless WordPress worth it for a small business website?
Usually not. For a five to fifteen page site with occasional updates, a well-built classic WordPress theme is cheaper, simpler to maintain and can still pass Core Web Vitals. Headless WordPress pays off when you publish a lot, expect traffic spikes, need strong security, or want to reuse content across a website, an app and other channels.
Is headless WordPress with Next.js right for you?
Headless WordPress with Next.js gives content-heavy sites speed, security and design freedom while keeping the editing experience teams already know. It works when previews, revalidation, SEO mapping and redirects are treated as core features.
Start with a clear content model, choose WPGraphQL or REST deliberately, and test the editor workflow as carefully as the front end. For Saudi organisations, build Arabic RTL, hreflang and hosting decisions into the plan from day one.
Planning a headless WordPress build?
Tell us about your content, traffic and languages. We will recommend classic or headless, outline the architecture and send a fixed SAR estimate.
Get a free consultation See pricingWant this handled for you?
We build and optimise sites like this every week. Book a free 30-minute call and we will tell you exactly what we would change on yours.
Get a free site review