Headless Testing and Troubleshooting
Test a headless form in three layers: WordPress, your server route and the browser. The first layer that fails shows where the problem is.
Use a test form while you work, because successful requests create entries and run actions.
Test Each Layer
Check that WordPress returns the form:
curl -i "https://cms.example.com/wp-json/core-forms/v1/forms/123"
Check that WordPress accepts a submission:
curl -i "https://cms.example.com/wp-json/core-forms/v1/forms/123/submit" \
-H "Content-Type: application/json" \
-H "X-Core-Forms-Key: $CORE_FORMS_API_KEY" \
--data '{"name":"Ada","email":"ada@example.com","_cf_page_url":"https://www.example.com/contact"}'
If you use a proxy, check your own route:
curl -i "https://www.example.com/api/submit" \
-A "Mozilla/5.0" \
-H "Origin: https://www.example.com" \
-H "Content-Type: application/json" \
--data '{"name":"Ada","email":"ada@example.com"}'
Finally, submit in a browser with the Network panel open. Test a success, a missing required field and an expired or missing captcha token.
Common Problems
| Problem | Likely cause | Fix |
|---|---|---|
404 rest_no_route |
Module off or wrong URL | Turn on Headless API and check /wp-json/ |
404 cf_unknown_form |
Wrong ID or renamed slug | Use the numeric ID |
403 cf_headless_disabled |
Form switch off | Turn on Headless mode and save |
403 from a starter |
Origin or user agent rejected | Match CORE_FORMS_ALLOWED_ORIGINS exactly and send a browser user agent |
401 cf_invalid_api_key |
Old or wrong key | Update the secret and redeploy |
503 cf_missing_api_key |
No key in WordPress | Generate and save one |
503 from a starter |
Missing environment value | Set all 4 variables |
413 from a starter |
Body over 16 KB | Raise the starter’s limit |
422 on every submission |
Captcha token missing or failed | Check the script, token, hostname and key pair |
422 cf_files_need_multipart |
A file field got text or {} |
Send multipart, or leave the empty field out |
401 cf_invalid_proxy_secret |
Wrong proxy secret | Copy the saved secret to your server |
400 cf_invalid_client_ip |
Missing or invalid IP header | Send one IP address |
| Too many submissions | All visitors share the proxy’s IP | Pass the visitor’s IP |
502 from a starter |
WordPress unreachable, redirect or firewall page | Use the final HTTPS URL and allow the server |
| “Form unavailable.” | Schema request failed | Check the module, form switch, slug and origin |
| CORS error in the console | Origin missing or written without a scheme | Add the exact scheme, host and port in WordPress |
Success but No Entry
Check these in order:
- The form saves submissions. Its setting can turn storage off while actions still run.
- The entry isn’t in the Spam view.
- The honeypot field is empty. A filled one returns success and saves nothing.
- You’re looking at the WordPress site and form ID your code posts to.
For missing emails, look at the action and email logs. An accepted submission doesn’t prove delivery.
Changes Don’t Appear
- Publish the form if draft publishing is on.
- Rebuild static pages that fetched the form at build time.
- Clear your framework or CDN cache.
- Hard refresh after a plugin update, because browsers and CDNs can cache
embed.js.
Check the Installation
wp core-forms doctor
It reports forms that have headless submissions on without an API key, along with queue and email health. Core Forms also writes rejected submissions and their reason to the PHP error log.
Launch Checklist
- The module, site key and form switch are on.
- Allowed origins list production and staging hosts.
- The key is in a server secret, or the form has a captcha if the key is public.
- The captcha works on the production hostname.
- Proxied forms send the visitor’s IP or don’t rely on IP-based limits.
- Uploads and payments work from the real front end.
- A real submission saved the entry and delivered each action.
- A failed submission shows a readable error.
Common Questions
Does the Front End Need WordPress?
No. WordPress stores and processes the form. The other site only needs to reach its REST API.
Is a Key in the Browser Safe?
Anyone who views the page can copy it and abuse it. A server route keeps it private and is the safer choice.
Do Emails, Webhooks and Integrations Run?
Yes. Accepted submissions run the form’s enabled actions. For a payment form, they wait for confirmed payment.
Is the Honeypot Field Required?
No. Core Forms adds an empty one for API requests. If you send it, leave it empty.
How Are Checkbox Answers Sent?
Send an array under the field’s name. A name ending in [] works too.