4.2.2
Patch release. Hot-fix for the headless embed.
What was wrong
The bundled `embed.js` (served from `/wp-json/core-forms/v1/embed.js`) was rendering `result.data.message` directly into the success card. But the form processor returns it as an object — `{ type: ‘success’, text: ‘…’ }` — not a string. JavaScript stringified the object to literal `[object Object]`, so every successful headless submission ended with that string in the success card. Same shape bug in the error path.
What’s fixed
Added a `pickText()` helper that: – Plucks `.text` when the message is an object. – Returns the value when it’s already a string (for forward-compat). – Falls back to a sensible default (`Thanks!` / `Submission failed.`) when the field is missing.
Applied to both success and error code paths.
Who’s affected
Anyone running the drop-in embed widget (the `<div data-cf-form=”…”><script src=”…/embed.js”>` pattern). Native-fetch integrations were always fine since they consume the JSON response themselves and know the shape.
The fix is live on the WP REST endpoint as soon as the plugin is updated — no rebuild required on the embed side.