Skip to main content

Headless WordPress with Next.js Frontend

Set up headless WordPress with a Next.js frontend: WPGraphQL, ACF fields, ISR, draft preview mode, and a publish webhook for decoupled content management.

Füllen Sie die Platzhalter aus

Edit the values, then copy your finished prompt.

Ihr Prompt
prompt.txt

                                

What this prompt does

This prompt sets up a headless WordPress backend feeding a Next.js [nextjs_version] frontend. On the backend it configures WPGraphQL, exposes [post_types] to GraphQL, maps ACF fields, enables preview mode for drafts, and wires a publish webhook to trigger [revalidation_method]. On the frontend it uses the App Router with your [rendering_strategy], a [graphql_client], dynamic routes for [content_types], SEO via next-seo plus Yoast data, and image optimization proxying WordPress media.

The structure works because decoupling WordPress means deliberately rebuilding the things you lose — preview, SEO continuity, and media handling. Mapping ACF to GraphQL keeps the editor's custom fields available in React. The [rendering_strategy] decides freshness versus speed per content type, and the publish webhook plus [revalidation_method] is what makes on-demand ISR update pages the moment an editor hits publish.

When to use it

  • You want the WordPress editor experience with a React/Next.js frontend
  • You need [post_types] and ACF fields exposed cleanly through WPGraphQL
  • You want draft preview working across the decoupled boundary
  • You need on-demand revalidation via [revalidation_method] triggered on publish
  • You're choosing a [rendering_strategy] that balances freshness and speed per content type
  • You care about preserving SEO and media optimization after decoupling

Example output

Expect a two-part setup: a configured WPGraphQL backend with [post_types] and ACF mapped to GraphQL, preview mode, and a publish webhook; plus a Next.js App Router frontend using [graphql_client], your [rendering_strategy], dynamic routes for [content_types], next-seo wired to Yoast data, media proxying, sitemap generation, and search via [search_approach], ready to deploy on [hosting].

Pro tips

  • Match [nextjs_version] to a version you'll actually run; App Router behavior and ISR APIs shift between releases
  • Map every ACF field you need to GraphQL explicitly — unmapped fields silently vanish from the frontend
  • Tune [rendering_strategy] per content type; ISR for fast-changing posts and SSG for stable pages is a sensible split
  • Verify the publish webhook and [revalidation_method] actually fire end-to-end before relying on them
  • Don't skip SEO continuity — proxy Yoast data and preserve URLs, or you'll lose ranking equity in the move
  • Test preview mode auth carefully; a misconfigured preview exposes drafts publicly

Frequently Asked Questions

How does content update on the frontend after I publish?
The backend fires a webhook on publish that triggers your `[revalidation_method]`, typically on-demand ISR. This regenerates the affected pages the moment an editor publishes, so content stays fresh without rebuilding the entire site. Verify the webhook fires end-to-end before relying on it.
Do my ACF custom fields work in the Next.js frontend?
Yes, the prompt maps ACF fields to GraphQL so they're queryable from React. Map every field you need explicitly, because fields that aren't exposed to GraphQL silently disappear from the frontend, which is a common headache when decoupling WordPress.
Will I lose SEO when going headless?
Not if you handle it deliberately. The setup wires next-seo to your existing Yoast data and proxies WordPress media. Preserving URL structure and SEO metadata across the decoupling is essential, since careless headless migrations are a frequent cause of lost ranking equity.
Can editors still preview drafts?
Yes, the backend enables preview mode and the frontend authenticates it so editors can view unpublished content. Configure the preview authentication carefully, because a misconfigured preview route can accidentally expose draft content to the public.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Mehr in WordPress & CMS Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support