Headless WordPress vs Sanity: Which Backend for Next.js?
Headless WordPress vs Sanity for a Next.js site: how editing, plugins, previews and upkeep compare, and the four questions I ask before choosing.
7 min read

On this page
Choosing between headless WordPress and Sanity for a Next.js site comes down to one trade. Headless WordPress keeps the admin your editors already know and skips a content migration, but you keep hosting, updating and securing WordPress, and most front-end plugins stop working. Sanity costs a one-off content migration and some retraining, then gives you structured content, an editing interface built around your team, and no WordPress server to maintain.
This guide assumes the front end is already decided: Next.js. The question here is only what sits behind it.
What changes when WordPress goes headless?
WordPress stops rendering the site. It becomes a content store that Next.js reads from, either through the REST API built into WordPress or through WPGraphQL, a free plugin that adds a GraphQL API.
What stays the same:
- Editors log in to the same admin, with the same posts, pages, categories, media library, users and roles.
- Plugins that work inside the admin keep working, such as Advanced Custom Fields and editorial workflow plugins.
- The content doesn't move, which matters when you have thousands of posts.
What changes:
- Front-end plugins stop working. Anything that outputs on the public page (page builder layouts, sliders, form builders, shortcodes, theme options) has to be rebuilt as Next.js components.
- Post content arrives as HTML. The block editor's output comes through the API as one block of rendered HTML, which the front end has to style. Getting blocks as structured data needs extra plugins and setup.
- SEO data has to be wired in. Yoast SEO, for example, adds its meta tags and schema to REST API responses, but your Next.js code has to read them and output them on each page.
- Previews need building. The Preview button in WordPress opens the page through the WordPress theme, which is no longer your site. You need a preview route in Next.js using its Draft Mode, plus authenticated requests so drafts can be fetched.
- WordPress still needs looking after. Hosting, core and plugin updates, backups and security all remain, on top of hosting the Next.js site. Moving the admin to its own subdomain keeps it away from the public site, but it still has to be maintained.
What changes when you move the content to Sanity?
Sanity is a hosted headless CMS. The content lives in Sanity's cloud, and editors work in Sanity Studio, an open-source editing app that is configured in code.
- Structured content. Each content type is a schema with typed fields, and rich text is stored as Portable Text, a structured format rather than a blob of HTML. The same content can appear on several pages, and the front end decides how it looks.
- A Studio shaped around your team. Fields, validation rules, document lists and custom inputs are all configurable, so editors see what this site needs and nothing else.
- Real-time collaboration. Several people can work in the same document and see each other's changes as they happen.
- Previews with an official path. Sanity's Presentation tool shows the live Next.js page next to the editing form, with click-to-edit overlays, built on Next.js Draft Mode. It still takes setup, but it is documented end to end.
- No CMS server to patch. The Studio's packages need occasional updates like any project dependency, and you still manage user access and API tokens, but there is no PHP server or database to secure.
The costs are real too:
- A one-off content migration. Posts and pages are pulled from WordPress, converted from HTML to Portable Text, and imported with their media. It's scripted work, and the messier the old content, the longer it takes.
- Retraining. Editors learn a new interface. A Studio that mirrors the site's pages makes this quicker, but it's still a change.
- Plan limits. Sanity has a free plan, but extra roles, comments, scheduled drafts and longer history come with paid plans. Check the current plans against your team size.
Headless WordPress vs Sanity, side by side
- Editing: WordPress is familiar on day one. Sanity is new to most editors but can be built around how your team works.
- Content structure: WordPress stores the post body as HTML, with extra fields added by plugins. Sanity is structured from the start.
- Plugins: headless WordPress keeps admin-side plugins and loses front-end ones. Sanity's plugins extend the Studio only. Either way, site features are built in Next.js.
- Previews: both need setup in Next.js. Sanity's Presentation tool adds click-to-edit on the rendered page.
- Upkeep: headless WordPress means two systems to host and update. With Sanity, you maintain the Next.js site and the Studio.
- Migration effort: headless WordPress needs no content migration. Sanity needs a one-off, scripted one.
When does headless WordPress fit?
- WordPress has to keep running anyway, for a WooCommerce store, memberships or another system the business depends on.
- It's a large publication with years of posts, many authors, and editorial workflows built in the WordPress admin.
- The content is mostly standard posts and pages written in the block editor, with little page builder use.
- Someone will keep WordPress updated and secure after launch.
When does Sanity fit?
- It's a marketing or company site built from reusable sections: services, case studies, team members, locations, landing pages.
- The same content appears in several places, such as testimonials or contact details shown across many pages.
- The pages were built with Elementor, Divi or another page builder. Those layouts have to be rebuilt in either case, so the familiar admin is worth less than it looks: editors keep the login screen, not the way they built pages.
- You want to stop hosting and patching a WordPress server.
- The site is getting a new design anyway. When I build a Next.js site from a Figma design, Sanity is the CMS I set up, because the content model can follow the design's sections.
How I decide between them
On a WordPress to Next.js migration, I ask four questions in this order:
- Does WordPress have to stay for something else? If a store or membership system depends on it, headless WordPress usually wins, because that server isn't going away.
- How much of the site is page builder or shortcode content? The more there is, the more has to be rebuilt anyway, and the less the familiar admin is worth.
- Who will maintain WordPress after launch? If the honest answer is nobody, choose Sanity. An unpatched WordPress backend is still a risk, even when visitors never see it.
- How do the editors feel about change? A team that publishes daily in WordPress and likes it is a strong reason to keep it.
When the answers are mixed, I lean towards Sanity for marketing sites and towards headless WordPress for large, post-heavy publications.
FAQ
Is headless WordPress faster than a normal WordPress site?
The public pages usually are, because Next.js serves them and WordPress no longer builds each page on every visit. A slow WordPress backend can still slow down builds and content updates, but visitors don't wait on it when pages are pre-rendered or cached.
Should I use the WordPress REST API or WPGraphQL?
Both work. The REST API is built into WordPress and needs no plugin; WPGraphQL is a plugin that lets Next.js request exactly the fields it needs, including related content, in one query. For a front end with many custom fields and relationships, WPGraphQL is usually the more comfortable choice.
Can I start with headless WordPress and move to Sanity later?
Yes. If your Next.js components take plain data and the WordPress-specific fetching sits in one place, you can later swap the data layer for Sanity and keep most of the front end. You still need the content migration at that point, so this delays the work rather than removing it.
Do Advanced Custom Fields and Yoast work with headless WordPress?
Yes, with wiring. ACF field groups can be exposed in the REST API with a per-group setting, or in WPGraphQL through the WPGraphQL for ACF extension, and Yoast adds its metadata to REST API responses. Your Next.js code then has to read those fields and output them.
Key takeaways
- Headless WordPress keeps the familiar admin and avoids a content migration, but WordPress hosting, updates and security stay on your list.
- Sanity needs a one-off migration and retraining, then gives you structured content, a tailored Studio and no CMS server to patch.
- Front-end plugins and page builder layouts must be rebuilt in Next.js with either option.
- If WordPress must keep running for something else, go headless; for marketing sites with nobody to maintain WordPress, choose Sanity.
Tags
- Sanity CMS
- WordPress Migration
- Next.js

About Keshur Gojiya
Web developer and HTML email specialist with 6+ years of experience, building websites and emails for businesses, startups and agencies.
Get to know me

