If your site creates posts from form submissions, like a directory listing, a job post or a classified ad, it’s helpful to send people straight to the post they just created. You can add that link to the confirmation message, the notification email, or both.
Requirements
- Gravity Forms (any license)
- A form that creates a post, using the Post fields or the Advanced Post Creation add-on
Option 1: A Short Link With {post_id} (No Code)
Gravity Forms has a {post_id} merge tag that holds the ID of the post the submission created. WordPress can find any post by its ID, so you can build a link like this:
<a href="https://yoursite.com/?p={post_id}">View your post</a>
Replace yoursite.com with your domain. WordPress redirects ?p=123 to the post’s pretty permalink, so visitors land on the normal URL.
If the post is saved as a draft or pending review, only logged-in users who can edit it will be able to see it. That’s worth mentioning in your confirmation message.
Option 2: The {post_permalink} Merge Tag (Free Snippet)
If you’d rather use the real permalink, the free Gravity Wiz snippet Include Post Permalink in Gravity Forms Confirmation or Notification adds a {post_permalink} merge tag. It also works with posts created by Advanced Post Creation.
- Open the snippet page and click Download Code. The raw code opens in a new tab.
- Copy it into a code snippet plugin like WPCodeBox or a custom plugin.
- Edit your confirmation or notification, open the merge tag list and choose Post Permalink.
Then use it in a link:
<a href="{post_permalink}">View your post</a>
Tips
- Use conditional logic on confirmations if only some submissions create a published post.
- For a page redirect confirmation, you can send people straight to the post by using the merge tag as the redirect URL.
- Test with a real submission, because merge tags like these only fill in after the post exists.
Need More Help?
If you still need help, use the chat or leave a comment below and we’ll get back to you.
Comments