Gravity Forms + Soft Gate
When Gravity Forms is active, the soft gate can submit a GF form instead of sending a plain wp_mail() email. This lets you:
- Customize the email design using GF notifications.
- Subscribe the visitor to a MailChimp list (or any other GF feed) at the same time they receive their magic link.
- Capture additional fields (name, company, etc.) alongside the email request.
The magic link URL is made available as a custom merge tag {magic_link_url} so you can insert it into any GF notification or feed template.
Prerequisites
- Gravity Forms installed and active.
- At least one GF form created with an Email field.
Creating the access request form
- In Forms → New Form, create a form for the soft gate access request.
- Add an Email field (required). This is the address Yoko Core will send the magic link to.
- Optionally add other fields (name, company, etc.) to capture lead data.
- Optionally add a Hidden field and set its default value to
{embed_post:ID}— Yoko Core uses this to populate the post ID automatically on submission. - Save the form.
Adding the {magic_link_url} tag to a notification
-
In the form editor, go to Settings → Notifications.
-
Edit (or create) the notification that should deliver the magic link email.
-
In the Message body, place your cursor where you want the link and either:
- Type
{magic_link_url}directly, or - Use the merge tag picker and select Soft Gate: Magic Link URL.
- Type
-
Example message body:
Hi {Name (First):1.3},
Click the link below to read the article:
{magic_link_url}
This link is valid for 30 days. -
Save the notification.
The same token URL is used for every notification and feed that fires for a single submission, so you can safely put {magic_link_url} in multiple notifications or feeds without generating duplicate tokens.
{magic_link_url} resolves in notifications and add-on feeds, and nowhere else. Put it in a confirmation message, a redirect URL, or an entry note and it is replaced with nothing, plus a line in debug.log.
That is deliberate. Anything rendered back to the browser would print the access link onto the page for whoever just typed an email address — handing out gated content without ever proving they own the mailbox. Refusing those contexts makes it impossible rather than merely discouraged.
Adding the {magic_link_url} tag to a feed (e.g. MailChimp)
GF feeds run after notifications. You can use {magic_link_url} as a merge tag value in any feed that supports custom fields or tag values. For example, to include the magic link in a MailChimp welcome automation:
- In the form, go to Settings → MailChimp (or your feed plugin).
- In the field mapping, create a custom field (e.g.
MAGIC_LINK) and set its value to{magic_link_url}. - In MailChimp, use
*|MAGIC_LINK|*in your automation email template.
Connecting the form to a post
Global default — to use a single form across all soft-gated posts:
- Go to Settings → Content Gating → Soft Gate.
- Set Default Gravity Form to your form.
- Save.
Per-post override — to use a different form on a specific post:
- Open the post in the block editor.
- In the Soft Gate panel in the Document sidebar, choose a form in the Gravity Form dropdown.
- Save the post.
Setting a per-post form overrides the global default only for that post.
How the form is displayed
When a Gravity Form is configured for a soft-gated post (globally or per post), the gate dialog is rendered by PHP with that form embedded directly inside it. The visitor completes the Gravity Form in the dialog and submits it via GF's own AJAX submission — no separate email field is shown. Yoko Core generates the magic-link token as the form is submitted and exposes it to GF notifications and feeds through the {magic_link_url} merge tag.
When no form is configured, the dialog instead shows Yoko Core's native email field, which posts to the soft gate REST endpoint.
Behavior without Gravity Forms
When no GF form is configured (or Gravity Forms is not active), Yoko Core falls back to a plain wp_mail() email using the subject and body configured in Settings → Content Gating → Soft Gate. Use {magic_link_url} in the Email body field as the placeholder for the access link.
Troubleshooting
| Symptom | Likely cause |
|---|---|
| No email received | Check GF form notifications are enabled and that SMTP is configured (WP Mail SMTP or similar). |
{magic_link_url} shows as empty in the email | The form was submitted outside the soft gate flow — via a GF shortcode on a page that is not the soft-gated post, or a form that is not configured as that post's gate form. Check debug.log for [yoko-soft-gate]. |
{magic_link_url} is empty on the confirmation page or in an entry note | Working as intended — see the note above. Use it in notifications and feeds only. |
| Magic link in email does not work | The token hash was not found or the row has expired. Tokens are not single-use — the same link keeps working for the full configured access duration, from any browser. If it fails, the token has expired or was purged; request a new link. |
| Form is not showing in the Gravity Form dropdown | Make sure Gravity Forms is active and at least one form exists. The dropdown does not appear if GF is inactive. |
| Submission succeeds but no token is created | A token is only issued when the submitted form is the one configured as that post's gate form (globally or per post) and the master Soft Gate toggle is on. Confirm with wp yoko soft_gate_tokens --email=<address>. |
| Repeated submissions stop producing links | Rate limiting: three requests per IP and three per email address, per ten minutes. |