Blog

Headless WordPress Forms Tutorial

Headless WordPress has no built-in form handling once you drop the theme layer. Here's how to wire a form in your custom frontend to a FormBridge endpoint.

← Back to the blog
AI Powered

Explore this article with AI

Get an instant summary, key takeaways, action items, and answers to your questions about this article.

Choose your AI assistant
ChatGPT Perplexity
Quick answer

Headless WordPress has no form handling at all, because the theme layer a forms plugin would rely on is never part of the request path. A form built in the frontend and posted directly to a FormBridge endpoint handles submissions independently of WordPress.

Headless WordPress has no form handling to fall back on

In a headless setup, WordPress is the content source — exposed over the REST API or WPGraphQL — and the actual site is a separate frontend (Next.js, Astro, Gatsby, whatever you've chosen). The theme layer that a forms plugin would normally hook into isn't part of the request path at all: your frontend never loads WordPress's PHP runtime, so plugins built for wp-admin and the classic theme lifecycle have nothing to attach to.

That means there's no default form handling of any kind once you go headless — not a broken version, just none. Whatever handles submissions has to live entirely inside the frontend and post somewhere that isn't WordPress.

Wire the frontend form to a FormBridge endpoint

Because the form is decoupled from WordPress anyway, it doesn't need the CMS in the loop at all — point it straight at a FormBridge endpoint:

<form action="https://app.formbridge.ai/api/forms/fb_8h2k9p" method="POST">
  <input name="full-name" placeholder="Full name" />
  <input name="email" type="email" placeholder="Email" />
  <textarea name="message" placeholder="Message"></textarea>
  <button type="submit">Send</button>
</form>

This works as a plain form tag in any framework — a React/Next.js component, an Astro island, a Vue template — since it's a standard HTML POST, not something that depends on the frontend's JS runtime. If your frontend needs to submit via fetch instead of a native form submit (for a custom validation flow or a single-page transition), post the same field data as multipart/form-data or URL-encoded form data to the same endpoint.

What you get without touching WordPress

Setting it up

Create a form endpoint in FormBridge, copy its URL, and use it as the action (or fetch target) for your form component. Since the endpoint accepts any field names, you don't need to coordinate anything with your WordPress content model — the form and the CMS stay entirely decoupled, which is the point of going headless in the first place.

Frequently asked

Why doesn't a WordPress forms plugin work in a headless setup?

Forms plugins hook into WordPress's PHP theme lifecycle, but a headless frontend never loads that runtime — it only fetches content over the REST API or WPGraphQL — so there's nothing for the plugin to attach to.

Does the form need to be a native HTML <form> tag?

No — since it's a standard HTTP POST, it can be submitted with fetch from any frontend framework's own submit handler, as long as the field data is sent as multipart/form-data or URL-encoded form data to the same endpoint.

Key facts

  • In a headless WordPress setup, the frontend never loads WordPress's PHP runtime, so plugins built for the classic theme lifecycle have no request path to attach to.
  • A FormBridge endpoint accepts submissions as a standard HTTP POST, independent of any frontend framework or of WordPress itself.
  • FormBridge provides notification emails, an autoresponder, and automatic spam scoring configured once from its dashboard, regardless of which frontend framework is submitting to it.

Get the next one in your inbox.

One email when we publish something worth reading. No spam — appropriately enough, we'd know.