Include Post Permalink in Gravity Forms Confirmation or Notification

July 29th, 2023: Added support for replacing {post_permalink} merge tag when it is used in GF Advanced Post Creation's post meta field map.

February 1st, 2023: Added support for returning permalink for posts generated by the GF Advanced Post Creation add-on.

There are two methods for generating a link to a post created by Gravity Forms. Both methods are intended for use in Gravity Forms’ confirmations and notifications (and another other place merge tags are support post-submission).

If you are automatically publishing user submitted posts, this is helpful for providing a link immediately to the user where they can preview their newly created post.

1. Short Link

This method requires no custom code and uses the default {post_id} merge tag.

<a href="http://yoursite.com/?p={post_id}">Post Title</a>

2. Permalink

This method requires some custom code which adds support for the {post_permalink}. The code also makes this merge tag available for selection in the merge tag list

<a href="{post_permalink}">{Post Title:1}</a>

gw-post-permalink

Step by Step

  1. Click the “Download Code” button above. It will open the “raw” code in a new tab.
  2. Select all of the code and copy and paste it into your theme’s functions.php file or as a snippet via a plugin like Code Snippets.
  3. Go to your Confirmation or Notification and select the “Post Permalink” option from the merge tag list (see the screenshot above).

Does this answer your question?

If it doesn’t, let us know in the comments.

Comments

  1. Bill Jensen
    Bill Jensen January 30, 2024 at 10:02 pm

    I give up. Tried everything but can’t get the post permalink to show in the notification email. I want the recipient to be able to quickly edit the submission.

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff January 31, 2024 at 7:13 am

      Hi Bill,

      Did you already add the snippet to your website? I just tested this and it works as expected. If it’s still not working for you, you can send us a message via our support form, so we can take a closer look at your setup and assist you to get it working.

      Best,

  2. Ian Sterne
    Ian Sterne March 14, 2022 at 5:31 pm

    I have a slightly different need for a post URL. I have the same form appearing on a number of product pages. I can use a merge tag to include the page title but not a link to the page. So no new post is being created I just want a link from the sending page so product details can be confirmed.

    Reply
    1. Dario Space
      Dario Space March 14, 2022 at 7:01 pm

      Hi Ian,

      From what I understand GF has an {embed_url} merge tag. Will this work for you?

      If not and if you have any further questions and you have an active license, you can get in touch with us via our support form.​ to dig into this.

      Cheers,

  3. Andy
    Andy July 6, 2021 at 6:45 am

    Is there a way to incorporate a gravity form link to add further notes to the form that we can add to the email notification? I want it to be a simple process for my admin team to follow, rather than having to go through many steps to reach the form.

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff July 6, 2021 at 7:14 am

      Hi Andy,

      We do not have a solution /snippet for this. You may want to check out GravityHopper, as they appear to have a solution for managing form and field notes.

      Best,

  4. Chef
    Chef February 13, 2020 at 9:27 pm

    This doesn’t work. I’ve updated my permalinks and still nothing. Is there something within the code I should be changing or is it supposed to work outright?

    Reply
  5. Rob
    Rob February 10, 2020 at 1:39 pm

    Why doesn’t this work with the SLACK integration? It simply shows {post_permalink} and no information. The data is not carrying across. It appears as a merge tag to select, fine. The second option with the html code doesn’t work either…

    What am I missing?

    Reply
    1. Rob
      Rob February 10, 2020 at 2:33 pm

      Hey Ryan, Don’t actually have an account. I thought this content did not require any additional products. Apologies if you can’t help publicly.

    1. David Smith
      David Smith Staff April 19, 2017 at 7:31 am

      Hi Shaun, the {post_edit_url} merge tag does not provide a link to the newly created post on the frontend but rather a link to edit the post on the backend.

  6. Sunit
    Sunit December 27, 2016 at 5:08 pm

    Hi David,

    I’m using Gravity Forms Post Updates plugin to update a post via the form. Is there a way I can pass the {post_id} to dynamically populate a shortcode value?

    where xx is the {post_id}.

    Reply
  7. Soso
    Soso June 18, 2015 at 6:35 pm

    A bit off topic. Can you please guide as to how should I check input in fields:

    1. Field where customer must enter only 11 digit number (personal ID) if not show error text msg
    2. Text field First Name / Last name / and other … input letters only in English, if not show error text msg
    3. How to change Fields width and height

    Thank you in advance!

    Reply
    1. Soso
      Soso June 18, 2015 at 7:10 pm

      Thank you David

      I thought that you can help me, because this is additional change and they can’t do this for me…

    2. David Smith
      David Smith Staff June 19, 2015 at 5:06 pm

      Hi Soso,

      1 – You can use the Gravity Forms input mask to limit to a set-length, numeric only string. The mask would look like: 99999999999

      2 – Not sure about this one. You would need to run the submitted data through a dictionary to know if it was in the correct language. There might be a cheaper way to accomplish this, I just don’t know how.

      3 – You can use CSS to target these elements; however, I think something like CSS Hero would be a lot easier for you.

    3. Soso
      Soso June 19, 2015 at 7:24 pm

      Hello David,

      Thank you again for your time and support,

      1 and 3 solution perfect for me, about 2 – English letters, I found that email field is used same logic that I wanted, in email form allows only English letters, using rules like this a-z 0-9, but I can’t find in code where it is placed

      Am I on the right way about English letters or not?

      Thank you in advance

    4. Soso
      Soso June 19, 2015 at 7:27 pm

      or can I use something like this?

      add_filter(‘gform_validation_3′, ‘validate_code’); function validate_code($validation_result) {

      //set regular expression variable $regexp = “/^[a-z]{3}/”;

    5. Soso
      Soso June 22, 2015 at 12:28 pm

      Hello David,

      Thank you for your support, I found solutions for this, I used 2 Single Input Text Name Surname with custom input mask:

      Option: a?aaaaaaaaaaaaaaaaaa

      • Use a lower case ‘a’ to indicate an alphabetical character.
      • Use a question mark ‘?’ to indicate optional characters. Note: All characters after the question mark will be optional.

      used “a” to determine how long name and surname can be, and it solved my issue :)

      now I trying to find solutions for drop down menu

      I want to have drop down menu with country list and another + Optional button to add another drop down field, if customer want to visit for example : NY (first drop down) and Berlin (+ another drop down list)

      “add row” this function already have List Field but it is not possible to add dropdown function in it

  8. Endtone
    Endtone June 4, 2015 at 10:48 am

    Very useful. Thank you so much for your blog and tutorials! Your website is definitely one of the best GravityForms resources I’ve seen!

    Reply
  9. Ayush
    Ayush May 28, 2015 at 4:20 am

    Hi!

    Bit off topic. Can you please guide as to how should I replace reCaptcha with the Google’s new NoCaptcha?

    Thanks!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Download Plugin

Include Post Permalink in Gravity Forms Confirmation or Notification

This field is for validation purposes and should be left unchanged.