Use Gravity Forms Merge Tags in Your Post Content

Adds support for Gravity Form merge tags in your post content enabling the use of a single confirmation page for multiple forms, more control over the styling and layout of your confirmation pages, and persistent confirmation pages.

This article requires the GP Post Content Merge Tags perk.

Buy Gravity Perks to get this perk plus 46 other premium Gravity Forms plugins!

View Plugin Buy Gravity Perks

gw-post-content-merge-tags-post-editor

Gravity Forms has excellent support for form confirmations. As always, Gravity Wiz aims to take that support a little further.

Gravity Forms provides an easy way to display personalized information via the “Text” confirmation type. You select which Merge Tags (which represent submitted form data) and place them in the text confirmation as desired. When the text confirmation is displayed, the merge tags will be replaced with the submitted data each merge tag represents.

But what if you wanted to do this on a separate confirmation page using the “Page” or “Redirect URL” confirmation types? You could readily pass the required data to the page via the “Pass Field Data Via Query String” option; however, while this option allows you to pass submitted data to the confirmation page, it does not provide a method for displaying that data on the confirmation page.

Post Content Merge Tags provides the following key points of functionality:

  1. Reclaim complete control over the styling of your Thank You / Confirmation pages. And use any Gravity Forms merge tags in the content of the page.

  2. Reuse the same confirmation page for multiple forms. For instance, you might have 25 forms on your site but would like to redirect users from all of those forms to a single, personalized “Thank You” page on submission.

  3. Implement persistent confirmation pages. For example, you could send the user an email including the confirmation page URL to their form submission, which they could save for future reference.

Ready to take your confirmation pages to the next level? Let’s dig in.

Getting Started

The following tutorial requires Post Content Merge Tags to be installed and activated on your site. Once installed, you can add merge tags to your confirmation pages, with ease. Let’s get started.

Steps

Step 1 – Create Your Form

Start by creating your form. There’s no special steps to take here. Build the form any way you please with any fields that make sense for your particular form.

Step 2 – Create Confirmation Page

Once your form is complete, it’s time to build the confirmation page. Create the page you’ll redirect the user to once they submit a form entry. It isn’t required for you to insert the page’s content during this step. You simply need to create the page.

Step 3 – Configure Form Confirmation

Navigate back to your form’s Settings page. Go to the Confirmations tab to set up a page redirect to the confirmation page you created in Step 2. Choose the page from the drop down, and check Enable Merge Tags in Page Content.

Set up a page redirect to the thank you page you created

Then, click Edit Page Content to add the desired merge tags to the post content of the confirmation page. Any merge tag that can be inserted into the “Text” confirmation’s “Message” field, can be used in the post content of your confirmation page. Post Content Merge Tags adds a merge tag button to the WordPress editor to simplify this step.

If your site uses a visual page builder, such as Elementor, you’ll need to wrap any merge tag content within the [eid] shortcode.

Only the field label is required for these post content merge tags to work. For example, the default merge tag for an Email field would be {Email:3}, where Email is the field label and 3 is the field id. Dropping the field id and just using the field label (like so: {Email}) is also supported. In fact, label-based merge tags are required if you will be using the same confirmation page for multiple forms. See below for more details.

That’s It

Once you have your confirmation page completed, fill out the form you created. If everything was set up correctly, you will have a merge-tag-powered confirmation page!

gravity-forms-post-content-merge-tags-thank-you-page

Tips for using a single confirmation page for multiple Gravity forms

If you have multiple forms that you would like to redirect to the same confirmation page, the first step is make sure you’ve set the confirmation for each form to redirect to your custom confirmation page.

It is important that the field labels for each form match the merge tag label in the confirmation page template. For example if your field label is Email, you’re merge tag would be {Email}. If you changed the field label to Email Address the merge tag for that form would be different and {Email} would no longer work.

This is another reason why you might consider setting an admin label for your form fields and using this instead of the field label when adding your post content merge tags. The admin label is less likely to change and also allows you flexibility on the field label between forms.

Comments

  1. Anthony R. Locke
    Anthony R. Locke March 14, 2024 at 1:06 pm

    If I have a generic form on all my posts, and all my posts have a variety of tags, and the user fills out that gravity form which creates a new post, how do I transfer the tags from the post they were on into the new post that is created by the form? If the new post that is created can have the same tags as the post where the form was submitted, then I can list those new posts as related posts. The trick is getting Gravity Forms to create the new post with the same Tags as the original post where the form was submitted. How do I copy the url post tags into the new post being created by Gravity Form?

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff March 15, 2024 at 6:30 am

      Hi Anthony,

      You’ll need to first populate a field on the form, with the current post tags. This is possible with GP Populate Anything. You’ll set up the field to use the current post ID filter and then select the tag you want to get. If you’re using our GF Advanced Post Creation add-on to create the post, you’ll map this field to the taxonomy you want to link it to, within the feed. I hope this helps. However, if you need further assistance with this, send us a message via our support form so we take a closer look at your setup.

      Best,

  2. corey H pensky
    corey H pensky October 17, 2023 at 5:12 pm

    Hello,

    Does this work with disable entry creation addon? I was hoping it would work on first load of the thank you page, but it doesn’t to be. Tried to remove the entry using GFAPI in after_submission hook, but same result. Any ideas?

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff October 18, 2023 at 5:58 am

      Hi Corey,

      This may require a custom code to delay the deletion of the entry until after the “Thank You” page loads. If you have a Gravity Perks license, please submit a ticket for this via our support form, so we can have our developers assist you with this.

      Best,

  3. ahmet
    ahmet June 15, 2022 at 5:14 am

    Hi, It seem really good job but I’d like to display merge tags in “any” page or post content not belong with redirecting “confirmation page” Is that possible? Thanks

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff June 15, 2022 at 7:22 am

      Hi Ahmet

      That’s also possible with Post Content Merge tag Perk. What you would do is pass the Entry ID or encrypted Entry ID via the URL eid query parameter and you can use the field merge tag on any page without it being a confirmation page.

      Best,

    1. Dario Space
      Dario Space May 19, 2022 at 2:51 pm

      Pedro,

      You should be able to add the merge in the merge tag in the link href or using the Block Editor href=”https://gravitywiz.com/?ref={merge_tag:1}”

      Best,

  4. reza
    reza October 15, 2021 at 4:54 am

    hi i need show in notifiction part of merge tag example: main data in feild 111111 merge tag in normal mode show :111111 in need send 2 number of end merge tag send to notifiction. plz help me thanks

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff October 15, 2021 at 6:38 am

      Hi Reza,

      I am not really tracking your question very well, but it looks you need help with the modification of the output of the value in a field. If you have an active Gravity Perks License, you can get in touch with us via our support form with additional information on what you’re trying to do so we can assist you.

      Best,

  5. Leonard
    Leonard April 4, 2020 at 1:11 pm

    Hi Great snippet

    I have a question, i use the elementor page builder, i create a page and insert textblock, this snippet not work, any idea????

    Thanks

    Reply
    1. Ryan Donovan
      Ryan Donovan April 5, 2020 at 3:03 pm

      Hello Leonard, Since you are using the Elementor page builder, page builders do not typically run the content through the standard WordPress filters used by Post Content Merge Tags to parse and replace the merge tags. This is a feature we have within our Post Content Merge Tags Perk. You’ll need to wrap any merge tags with the [eid] parameter to wrap your merge tags to ensure replacement. If you need a license, check out our pricing found here. 😀

    1. Ryan Donovan
      Ryan Donovan February 19, 2020 at 12:58 pm

      Hello Stephen,

      Excellent question. This snippet is used for allowing merge tags to be used in your confirmation pages allowing you to have much more control over the styling and layout of the page. As for checkbox fields, you can use Gravity Forms built in merge tags to use merge tags within form fields. Here is the documentation for that Checkboxes Merge Tags. :)

  6. ltower
    ltower October 16, 2019 at 6:09 am

    Hi, got a couple of errors for encrypt and decrypt i.e.

    ‘GFCommon::encrypt() is deprecated since version 2.3! Use GFCommon::openssl_encrypt() instead.’

    Updated both to ‘openssl_encrypt’ and works fine now.

    Reply
  7. Alistair Mckenzie
    Alistair Mckenzie June 26, 2019 at 12:55 pm

    Hi i have copied the code and added to my functions file, i have set up one form that once submitted pre-populates another form all good but i cannot get it to add to the html block i tried adding {Name:5} as that the name and field id from form 1, obviously doing something wrong and help greatly appreciated

    Reply
  8. Brian
    Brian October 17, 2018 at 8:39 pm

    Hi, I’m using the snippet and everything seems to be parsing as it should with the exception of a field using checkboxes. There are 6 choices which they can select from and they can select multiple selections. How would I enter this into the redirect string and how would I implement this on the confirmation page?

    Thanks in advance for your help!

    Reply
    1. Brian
      Brian October 18, 2018 at 10:59 am

      Unfortunately the site is in a staging area password protected. But, here’s basically the setup and text with the merge tags:

      Thank you, {Name (First)}, for choosing us! We look forward to seeing you on {Desired Date} for {Number Of People}! The services you selected are:

      {Massage Services}

      Confirmation Information We will contact you via phone at {Phone} or email at {Email} to confirm your appointment.

      Thank you!

      Everything displays but the Massage Services which is the checkboxes.

  9. Luqman
    Luqman March 7, 2018 at 9:26 pm

    Hi, David.

    I noticed there’s difference between the code that we supposed to download and the code in your tutorial video.

    Which one should I use?

    My website went whitescreen after I put the snippet according to your video.

    Reply
  10. Mark Fouet
    Mark Fouet February 15, 2018 at 12:54 pm

    Hi, just implemented this and am having the problem where the field merge is working when the form is added to the default WP editor field for the confirmation page, but if I then use Beaver Builder to format the page, the merge tags don’t work – you only see the name of the merge tag itself.

    I followed the instructions here – https://gravitywiz.com/how-to-populate-entry-data-from-one-form-into-another-using-gravity-forms/

    How can this be resolved please?

    Thanks!

    Reply
  11. Michael
    Michael February 12, 2018 at 11:34 am

    Hello David, Thanks for taking the time to write this tutorial! I am having an issue with the redirect to “thank you” page confirmation. This merge tag….

    Hello {Name: (First):1.3},

    Works fine on for text confirmation but “page confirmation” option just outputs Hello {Name: (First):1.3},

    I did add the snippet just in case and I have “no conflict mode” set to yes.

    Any thoughts on what might be going on so I can troubleshoot further?

    Reply
  12. Junry
    Junry October 3, 2017 at 8:12 pm

    Thanks David,

    But is there a way to remove the query string on the redirected thank you page from gravity form.

    Currently, when a user fill up a gravity form I set up that the user will be redirected to a thank you page.

    But the problem is there are random alphanumeric on the query string.

    domain.com/thank-you/?eid=qw5s6uR4EPkmY5HF%2FzqVcp5oQDkmj0hBXh5kroOrKEY%3D

    I want it to redirect only to a page like: domain.com/thank-you

    I is there any filter or hooks from gravity form to remove the eid string??

    Regards, Junry

    Reply
    1. David Smith
      David Smith Staff October 28, 2017 at 9:34 am

      There is the idea of storing it as a cookie but this is not currently supported. The plugin version of this supports a Pretty ID which is a 6-digit string like: “a34bg3”.

    2. Dee
      Dee March 16, 2018 at 4:12 am

      Hi Junry,

      did you work out how to remove the eid from the url – We are not using merge tags, but it’s still showing up in the redirect url and we’d like it removed

      Dee

  13. Jun
    Jun October 2, 2017 at 3:35 am

    Avada 5.2.2 Gravity Form 2.2.5

    I’m trying to remove the ?eid=qw5s6uR4EPkmY5HF%2FzqVcp5oQDkmj0hBXh5kroOrKEY%3D in the page redirected from gravity form.

    I’m want to do this on the child theme but when I tried to duplicate the code written below including the folder structure and commented the part with merge tags it doesn’t work. For now I just commented the code in the parent theme which will be removed once the Avada theme is updated.

    Any idea or work around on this set up would be appreciated.

    Reply
    1. David Smith
      David Smith Staff October 3, 2017 at 7:35 am

      You can remove that but if you do, it won’t replace any Gravity Forms merge tags in your content.

  14. Chris
    Chris July 27, 2017 at 5:37 pm

    Is there a way to pull data from a list? Specifically a multi-column list? Not sure what that conditional merge tag would even look like, but it has to be possible….right? :)

    Reply
    1. David Smith
      David Smith Staff July 30, 2017 at 9:55 am

      As far as I know, the List field only supports pulling all data (i.e {List:2}). Given the dynamic nature of the List field, static merge tags for rows that might not exist doesn’t seem practical. I’d love to hear more about your use case?

    2. Chris
      Chris July 31, 2017 at 12:06 pm

      Hey David, For example, I have a list in my form with 3 columns: name, hair color, and age (terrible example, but let’s roll with it.)

      The question is, list your children and their attributes. So my users would input the information in this List like so:

      Tom, red, 11 Jane, brown, 9 David, brown, 18

      Now, if I wanted to create sentences in the output that said, “Tom has red hair and is 11 years old.” “Jane has brown hair and is 9 years old.” “David has brown hair and is 18 years old.”

      How could I do that with the list merge tag?

      Currently, I am able to list each answer but it is by column and the output is comma separated. Here is what I have in my functions.php file now because I thought it would be a good start to a List specific filter.

  15. John Kirker
    John Kirker February 22, 2017 at 6:27 pm

    Is there any way to redirect people to another page in the event the marge tags don’t exist? The problem I see is that when people revisit a confirmation page later, the tags no longer exist so they see what they think might be gibberish. Thoughts?

    Reply
  16. David
    David November 16, 2016 at 3:46 pm

    Support for integration with Beaver Builder…

    Hey there – GREAT job. Here is my problem though. When I add through a BeaverBuilder module, it doesn’t work. If I add through the default WordPress editor, works like a charm. Thoughts?

    Check out http://danny.codelessme.net (bottom of the page – calculation button)

    Reply
    1. David Smith
      David Smith Staff November 16, 2016 at 8:51 pm

      My assumption is that Beaver Builder does not run the content through “the_content” filter which this snippet relies on. We have a perk-version that’ll be available later this week (beta, by request) that adds support for an [eid] shortcode so you can process merge tags anywhere that shortcodes are supported.

    2. Michael
      Michael November 30, 2016 at 8:18 pm

      Oops. Should have replied here.

      It does work with BeaverBuilder, at least it is for me.

      Check you’re placing in the correct merge tags. I simply had {Name(first)} and it wasn’t working…until I realised I had two Name fields in my form. When I made it specific {Name(first):2.3} – getting the actual full merge tag from the ‘text confirmation’. It displays no problem.

      So try that.

    3. Michael
      Michael November 30, 2016 at 8:42 pm

      Ok maybe I was too eager. No idea what I’m doing…maybe I need more coffee, it doesn’t work out of the box. Bummer.

      See you got yours working. Using the shortcode?

    4. Steve
      Steve May 8, 2017 at 10:40 am

      Any updates on the shortcode feature coming out of beta? I too use page builders that don’t accept the brackets, but work fine with other plugins that use short codes.

    5. David Smith
      David Smith Staff May 9, 2017 at 1:24 pm

      Hi Steve, we’re going to bring GF Post Content Merge Tags out of beta this week. Would you like me to send you an email when it happens?

  17. Kyle
    Kyle November 4, 2016 at 2:28 pm

    This is brilliant and I thank you for creating this!

    One question. I am trying to pass the total $ amount to my facebook pixel in the currency line. I’ve testing to make sure the code snippet and merge tag is working and it successfully passes the total to the page. but, It doesn’t seem to be working for my FB pixel. Does this have the ability to pass {Total} to the pixel code?

    Reply
    1. David Smith
      David Smith Staff November 9, 2016 at 5:13 pm

      I would expect this to work. If you include just the {Total} merge tag outside of the pixel, it works, correct?

  18. Lisa
    Lisa October 21, 2016 at 11:01 am

    Is it possible to use this code to display custom user meta data for pages that are not confirmation pages? For example, if I wanted to use the {user:first_name} in a text widget to display the first name of the logged in user, or {user:state} to show the logged in user’s state name on a main page (where state is a custom field)?

    Reply
    1. David Smith
      David Smith Staff October 30, 2016 at 11:10 pm

      Hi Lisa, no, that is not possible with this snippet. This snippet requires that an entry ID be passed via the “eid” parameter in the query string so it only works in places where you would have that entry ID (like the confirmation page or a confirmation redirect).

  19. Thom
    Thom September 26, 2016 at 2:22 pm

    Hi David,

    I’m having trouble installing the php.

    I’ve tried several php plugins but when I save a new snipped (this one) it gives me a 404.

    Can you please advice? Thanks

    Reply
  20. Linz
    Linz September 22, 2016 at 11:56 am

    This is absolutely fantastic. Thank you.

    I find it works brilliant when I redirect to a standard WordPress Page.

    However, if I try and include the merge tags within a custom template I’ve created for the re-direct page it doesn’t seem to work.

    Any thoughts?

    Reply
    1. David Smith
      David Smith Staff September 22, 2016 at 12:16 pm

      Hi Linz, you’ll need to run any content you want parsed for merge tags through the “the_content” filter.

      $content = 'any and all content you want parsed for merge tags'; echo apply_filters( 'the_content', $content );

    2. Linz Darlington
      Linz Darlington September 22, 2016 at 12:22 pm

      Thanks David.

      My knowledge is a bit patchy, so sorry for the newb follow up query.

      If I wanted to use that code, I would add it into my functions.php right? Or would I need to include it within the php template file?

      I assume I’d need to replace ‘any and all content you want parsed for merge tags’ with the content I’d like to parse?

      How would I lay this out? For example, would I contain the merge tags “{Email:5}’

    3. David Smith
      David Smith Staff September 22, 2016 at 8:17 pm

      Just realized it would actually be easier to to this:

      gw_post_content_merge_tags()->replace_merge_tags( $content );

      The $content variable would be any content that might contain merge tags. The merge tags would be in whatever format you want to use, either full merge tags like {Email:5} or label-only merge tags like {Email}.

  21. Steven
    Steven September 7, 2016 at 5:38 pm

    Hey there!

    Totally love this snippet. I was wondering if there is a way to change the reference that pulls the form data from an entry id to a field number value? We are using the unique id perk and would love to make it work with that field so we have the ability to change it incase it was ever compromised.

    Thanks!

    Reply
    1. David Smith
      David Smith Staff September 14, 2016 at 9:23 pm

      This isn’t currently supported but I’ve added it to the feature request list for this perk. It’s a good idea!

  22. Steven
    Steven August 23, 2016 at 11:11 pm

    I have been looking for something like this for a while. We need it to use a lot of tracking codes effectively. It also would help solve issues I have had where people do multiple entries unknowingly by hitting the back button when on the confirmation message.

    I got it to work under posts, but since we use Advanced Custom Fields to display page content, it doesn’t work there. Any type of work around to get it to work with ACF?

    Reply
    1. Steven
      Steven August 23, 2016 at 11:12 pm

      I also noticed that the date merge tag doesn’t seem to come through. Although I can just set that as a default value and in a field and pull it in that way.

    2. David Smith
      David Smith Staff August 24, 2016 at 11:13 am

      Hi Steven,

      I confirmed that Date field merge tags are working on my end. Make sure the merge tag you are using is correct.

      If you’re using ACF, I assume that you are manually fetching and outputting the ACF fields in your theme files? If so, you can just run the content through “the_contnet” filter:

      $content = 'whatever content';
      echo apply_filters( 'the_content', $content );
      

      Hope this helps. :)

  23. Alistair Gill
    Alistair Gill August 16, 2016 at 9:19 pm

    Hi,

    Just wanted to say thanks for this excellent tutorial and code snippet.

    I managed to use merge tags in a normal WordPress page that I use as a redirect confirmation. This was the final step in personalising my confirmation messages, so I really appreciate the guidance.

    I actually just published a tutorial myself on how to use Gravity Forms and MailChimp together to create an email marketing system. The idea is that you use the conditional logic in GF to add a user to a specific group in a MailChimp list. That opens up huge possibilities for sending personalised emails based on what a user selects in a form. If you’re interested, you can check it out here:

    https://www.alistairgill.com/ultimate-email-marketing-guide/

    Having the opportunity to personalise the confirmations using merge fields is the icing on the cake! Thanks.

    Reply
    1. David Smith
      David Smith Staff August 16, 2016 at 9:54 pm

      Thanks for sharing, Alistair. And I’m happy to hear you were able to make use of this functionality!

  24. sharon
    sharon August 12, 2016 at 5:10 pm

    Hi David!

    I just wanted to say THANK YOU SO MUCH for this write up. I’ve been wanting to do this for a long time, but never quite figured out how. I absolutely LOVE my personalized confirmation pages now- and I can’t wait to explore more of your GF “Perks!”

    Thanks again! Sharon

    Reply
    1. David Smith
      David Smith Staff August 13, 2016 at 1:02 am

      My pleasure, Sharon. I’m glad you found this useful. We’re actually converting this specific functionality into a perk right now and it’ll be even easier to setup and get going. :)

    2. Sharon
      Sharon August 13, 2016 at 1:37 am

      Hi again! I just happened to notice that this feature doesn’t seem to be working on mobile/WPtouch (even though I have the same snipppet added to my WPtouch theme’s function.php.

      Is there some other reason why it might not be working?

      Thanks again! thenourishedcook.com (see envelope icon in footer for an example)

  25. Andre
    Andre July 29, 2016 at 9:14 am

    I am trying to set up the meta tags but for some reason they are not working. I am using {name}, {address}, {email}. Does anyone possibly know why this could be? Thank you.

    Reply
    1. Jordan Smith
      Jordan Smith July 29, 2016 at 10:09 am

      Hi Andre,

      I just did a quick test of this and it appears to be be working correctly for me. Make sure that the merge tag values match the field labels exactly. For example, if the form field label is “Name” the merge tag would be {Name} not {name}.

      Let me know if that fixes the issue you’re having. Thanks!

    2. Andre
      Andre July 29, 2016 at 10:14 am

      Hi Jordan, thank you. I am new to this. Is there a place I can copy and paste the meta tags from to make sure they are the same? Or where do I find the value of the meta tags?

      Thank you much appreciated.

    3. Andre
      Andre July 29, 2016 at 10:30 am

      Hi,

      Ok yes it makes sense I have done that and I am still getting this – my entry id shows up and that is it. Not sure why: We are excited to host you:

      Here is your registration details:

      Your registration id is: 32 {Name (First)},

      {Name (Last)},

      {Address},

      {Phone},

      {Church:},

      {Email} If you have any question or need further assistance please don’t hesitate to contact us at (021) 202-4850 or email us info@vocapetown.org

    4. Andre
      Andre July 29, 2016 at 11:51 am

      Hi Jordan,

      Ok I activated the twenty twelve theme and it still had the same challenge.

      I also disabled all my plugins except the gravity plugins, with the twenty twelve theme still active and still had the same challenge.

    5. Jordan Smith
      Jordan Smith July 29, 2016 at 12:04 pm

      Did you add the Post Content Merge Tags snippet to the functions.php of the Twenty Twelve theme?

    6. Andre
      Andre July 29, 2016 at 12:13 pm

      No I didn’t, but I opened a new form and it seems to be working fine with default fields, I am going to test it out with all my fields now.

  26. Cecil Bordages
    Cecil Bordages July 27, 2016 at 6:05 pm

    I saw an earlier thread with a problem with the {Email} field. After a lot of A/B testing, it would appear that {Email} (or whatever the label on you email field) works just fine. EXCEPT that when you have email confirmation turned on. Then the result is blank.

    Here is an actual URL to a Thank You page: http://www.staging7.paals.org/donation-success/?{Name_(First)}&{Total_Amount}&{Email}&{Beneficiary}&eid=1232

    When email confirmation turned on in GF, nothing is shown on the page. When email confirmation is turned off, the email address is shown as expected.

    If you want to have email confirmation turned on (like we do), then you have to use {Email:17} in both the query string and on your confirmation page. So not too bad, but it does take extra effort to ensure email is handled correctly in each confirmation query and page.

    Hope I’m wrong about this and there is another solution, but so far I haven’t been able to find one.

    Reply
    1. David Smith
      David Smith Staff August 8, 2016 at 2:51 pm

      Hi Cecil, thanks, this has been fixed in the GP Post Content Merge Tags beta. Ping me via support to get a copy. :)

  27. Chris
    Chris July 12, 2016 at 9:21 am

    Good write up. Not sure why GF doesn’t make it this clear. I would suggest that you show usage of the Redirect Query Strings in your article (usage instructions screenshot).

    Thanks!

    Reply
  28. Rose
    Rose June 14, 2016 at 1:13 am

    Hi David

    I’m having trouble getting this to work and after reading through all the comments, I suspect it is because the_content filter is not being applied to the page as I’m using a custom function to add the page contents.

    In one of your replies you say “run your content through the gw_post_content_merge_tags()->replace_merge_tags() function manually.”

    Do you mean to add a filter to my custom content and if so where should I do this and what exactly should I add if the custom content is called ‘add_custom_page_contents’?

    Please note, I’ve added your snippet to a separate php file that I’m including via composer therefore I’m not using the functions.php. I confirm the snippet is there because I can see it passing the eid.

    Thanks Rose

    Reply
    1. David Smith
      David Smith Staff June 30, 2016 at 10:01 am

      Hi Rose, if you’re outputting your content somewhere, you’ll need to capture it as a string and run it through the gw_post_content_merge_tags()->replace_merge_tags() before you output it to the screen.

  29. Josh Carey
    Josh Carey May 18, 2016 at 12:16 pm

    Hey there, I’m having a hard time finding the answer to a question… if its even possible, that is… This is a great solution, by the way. I have it working successfully with my theme.

    What I’m needing is to retrieve the Featured Image of the post that form was embedded in. I’m obviously able to pull in the custom field values, as well as the standard GF tags with the embed page id, url, etc.

    So to clarify, I’m trying to setup notifications (both the page that the user is redirected to, and the notification email that is sent) – that will display the custom message with their name, the page name the form was on (which has the page url added), along with the featured image of the page that the form was submitted on. Does that make sense? Is this even a possibility? Or even having the possibility of submitting an ACF custom field defined image?

    Reply
    1. David Smith
      David Smith Staff May 24, 2016 at 9:33 am

      It’s possible but we don’t have a ready solution for this. GF Support might have something handy.

    2. Josh Carey
      Josh Carey May 24, 2016 at 9:52 am

      Thanks so much for the reply, David. I did end up getting GF Support in on it. It took a few emails back-and-forth but they finally got a solution for me.

      Just in case anyone is curious, or might need this sort of functionality, here is the solution from GF Support:

      Add a field to your form (it can be a hidden field or single line text field set to admin only visibility.) Then, check the box on the advanced tab to “allow field to be populated dynamically” and give it a parameter name of: “thumbnail_url”

      Then, add this code to your theme functions.php file:

      add_filter( ‘gform_field_value_thumbnail_url’, ‘populate_thumbnail_url’ ); function populate_thumbnail_url( $value ) { global $post; return wp_get_attachment_url( get_post_thumbnail_id( $post->ID, ‘thumbnail’ ) ); }

      Now, in your notification, you can use the merge tag for that field in your form, wrapped in an HTML img tag, like this:

      That will embed the thumbnail in your notification email.

      So, using this along with Gravity Wiz’s “Merge tags in your post content” – I simply removed the form field index number, just as you would with any other merge tag. So it keeps the same convention when using the merge tags.

    1. Adam
      Adam April 23, 2016 at 4:06 pm

      Sorry please try again. I accidentally put the extra php in the functions.php when I recopied the snippet. Thanks David!

    2. Adam
      Adam April 23, 2016 at 4:15 pm

      Ok – was able to dig into this a little more and find the root problem. My theme Divi is using templates that serve as global elements. Your snippet is still working on non-global elements, just not the ones that are global, serving as templates that are being used with multiple pages.

      Is there something extra I need to add to make it work for these areas in the page.

      Thanks David.

    3. David Smith
      David Smith Staff April 23, 2016 at 4:59 pm

      This snippet just relies on the “the_content” filter. This is when the merge tags are replaced. If you apply this filter to your global content it will work.

    1. David Smith
      David Smith Staff April 18, 2016 at 8:52 am

      Most likely the_content filter (which is automatically applied to the post content on most WordPress themes) is not being applied on your theme or at least to this specific content. Is this content in the post body? Are you using a page builder of some sort? If so, you’ll need to run your content through the gw_post_content_merge_tags()->replace_merge_tags() function manually.

  30. Phillip W.
    Phillip W. April 10, 2016 at 5:04 pm

    Dumb question- How do you get back to an encrypted url? After leaving the confirmation page how can we easily navigate back to it?

    preferably I’d like if it could be a tag to add to an email confirmation and have added to a hidden field in Gravity Forms.

    Any thoughts?

    Reply
    1. Phillip W.
      Phillip W. April 10, 2016 at 5:15 pm

      Actually figured out the email notice part.

      How do we add it to the back-end in a field so an admin can find the entry id and URL?

    2. David Smith
      David Smith Staff April 10, 2016 at 6:13 pm

      Hi Phillip, you can add your own sections to the Entry Detail via the gform_entry_detail_sidebar_middle hook. To get the encrypted entry ID, just pass the $entry[‘id’] to the gw_post_content_merge_tags()->prepare_eid( $entry['id'], true ) method. You can then hardcode the rest of the confirmation URL.

  31. Adam
    Adam April 4, 2016 at 12:03 pm

    Is there a way to display a single merge tag on a confirmation page that is populated by various fields that have similar Admin Labels. For instance, we have a multiple drop downs that have conditional logic built in. We want all the conditional data to all go to the same merge tag in the confirmation.

    Please let me know if this is doable or how to handle it because it seems like it is only working for only for the first field.

    Thanks!

    Reply
    1. adam
      adam April 4, 2016 at 9:38 pm

      Just mapped them to a single field. Very amazing code you produced there. Thanks so much. Huge huge help.

  32. Adam
    Adam April 4, 2016 at 11:21 am

    Is there a way to hide unused merged tags in the confirmation page? So you don’t have “{sampletag}” displayed on the post? Thanks!

    Reply
    1. Adam
      Adam April 4, 2016 at 12:08 pm

      Woops – I was wrong. I was using GF. Looks like they automatically hide using Label. Amazing :)

    1. David Smith
      David Smith Staff April 1, 2016 at 3:16 pm

      Hi Sam, change the merge tag to {E-mail} to match your field label and you should be good to go. :)

    2. Sam Bean
      Sam Bean April 1, 2016 at 3:21 pm

      I will try that, but they used to both be “Email” and it still did not work. I changed it to “E-mail” in case there was a conflict. I have also tried using an admin label (I called it Email1). When I used the admin label, it returned the phone number on the confirmation page. Yes, I put the admin label in the correct spot in the form… I checked. I have not tried it as {Email:20} yet, but I want to use this page with a bunch of similar forms.

    3. David Smith
      David Smith Staff April 4, 2016 at 11:41 am

      Hi Sam, not sure what the issue could be. I just confirmed that the Email field in the demo works.

  33. Ed Nailor
    Ed Nailor March 10, 2016 at 3:03 pm

    David,

    First, thank you for this. It has really helped with an internal project we have and I appreciate it greatly. If you are ever in the Charlotte, NC area, please let me know and the first drink is on me!

    I do have a question.

    I am using the {all_fields} tag but do not want the Gravity Forms styles to be added. I know on the notification forms, we have the ability to turn off the styles… Any idea how we can remove the styles using this form?

    Thanks, Ed

    Reply
    1. David Smith
      David Smith Staff March 25, 2016 at 4:51 pm

      Hi Ed, I’ll take you up on that drink one of these days. I have a friend in Charlotte so I’m sure I’ll be there sometime this year. :D

      In regards to the {all_fields} styling, unfortunately, the styles are all inline. You can override them with some very specific CSS. It’s a lot of work. :P

  34. David Hanas
    David Hanas March 10, 2016 at 12:32 am

    David, This is a wonderful snippet, thanks for sharing.

    I have a special case where on my “thank you” page I’d like to use the merge tag either in a custom field (I use Advanced Custom Fields), or in PHP / my template code. Is that possible?

    It works fine and as intended in the post content. Was just trying to do a little “more” with this, and could use some direction.

    Thanks for your help!

    • Dave
    Reply
    1. David Smith
      David Smith Staff March 25, 2016 at 4:53 pm

      Hi Dave, you can get the entry via PHP like so:

      $entry = gw_post_content_merge_tags()->get_entry();

      And then you can access any of the field values by field ID:

      $entry[12]

  35. Fox Oak
    Fox Oak February 27, 2016 at 7:49 pm

    Hey David, This snippet sounds like exactly what we need to get our confirmation pages up a running. However, when I paste the snippet into my functions.php it crashes my site. Can you help me? sorry PHP Noob here!

    Reply
  36. Merri Dennis
    Merri Dennis February 13, 2016 at 2:04 am

    Thank you so much for this code. It is exactly what I needed to show a confirmation page for the customer to review their order data.

    You’re wonderful!

    Reply
  37. Eric
    Eric February 9, 2016 at 12:31 pm

    Hi Dave,

    Thank you for this bit of code. It works flawlessly on a standard Gravity Form form. I have one thing that I can’t seem to figure out though.

    How can I add the eid to the url? I have to use the “Pass Field Data Via Query String” in the confirmation settings due to the fact that I have multiple forms in one.

    Thanks

    Reply
    1. Eric
      Eric February 9, 2016 at 12:40 pm

      Hi Dave,

      Sorry about that, just seen how to add it using eid={entry_id}

      The url is now like /thank-you/?eid=52553&otherParam but the text being displayed on the page is {Email} and {Name (First)}

      Any idea what I might be missing?

      Thanks

    2. David Smith
      David Smith Staff March 8, 2016 at 10:49 pm

      Hi Eric, it should “just work” if the eid parameter is present and the entry ID is valid. I’m assuming that {Email} and {Name (First)} actually match up to field labels on the form?

  38. katrina
    katrina January 31, 2016 at 2:56 pm

    Hi David,

    Thanks so much for this! I am able to get it to work, so far as i can tell, i am just concerned about the security aspect, and since i am not a coder, much of the snippet is foreign to me, so i just wan to be sure i am using it correctly. I have a few questions…

    1. My concern is that when i submit the form, all the merge tag values are appended to the url, but none of them are encrypted. Is this correct? For example:

    http://mywebsite.com/thankyou/?I_am_registering_for_the_january-eventKatrina$5,250_00$1,500_00&eid=dVJtR8w5eIxAJgxfCIs3wCMNqrWC9Z7KXmL7oKjuCas%3D

    Is this perfectly fine, because the form ID is encrypted?

    1. I believe i achieved this by modifying the following code in teh snippet:

      $this->_args = wp_parse_args( $args, array(
          'auto_append_eid' => true, // true, false or array of form IDs
          'encrypt_eid'     => true,
      ) );
      

    Is this OK? or should i have added, instead, this extra bit of code at the end of the main snippet:

    gw_post_content_merge_tags( array( ‘auto_append_eid’ => true, ‘encrypt_eid’ => true ) );

    1. I have managed to send a link in teh notifcation to a persistent confirmation page using the following link:

    http://mysite.com/confirmation-page/?eid={encrypted_entry_id}

    This is the only place i have used the merge tag {encrypted_entry_id} anywhere at all. Do i need to add this anywhere else on my site, form, or functions.php file?

    Sorry for so many questions, and thanks in advance if you have a moment to answer.

    Kindly,

    Katrina

    i placed the entriety of the snippet in my function.ph p file

    Reply
  39. Sam
    Sam November 2, 2015 at 8:18 pm

    Can merge tags only be submitted in the confirmation page text box, or can I put them in any template file? I added the code snippet to my functions.php and I added a merge tag to my template file, but for some reason it’s not working. Here is what I have in my content-link.php:

    Reply
  40. David
    David October 26, 2015 at 3:53 pm

    After I submit this, I get my page and it has ?eid=1048 on the end of the url, but the web page where I have my merge tag on only displays the merge tag code, not the text.

    What’s wrong?

    Reply
    1. David Smith
      David Smith Staff October 26, 2015 at 8:59 pm

      Try setting your theme to WP default theme (like Twenty Fifteen). If it works in that case, it probably means your theme is not running the content through “the_content” WP filter which this snippet relies on to replace the merge tags.

  41. Sam
    Sam September 29, 2015 at 11:54 pm

    Hi. I can’t get this to work. Do I need to buy Gravity Perks to make this work? I’m trying to get a price to show up on the confirmation page which is a redirect to a URL. Can only get the name of the fields to show up and not the actual field content.

    This is the form – https://www.taxwiseaustralia.com.au/pay/

    This is the confirmation page – https://www.taxwiseaustralia.com.au/thank-you-payment/

    Want to put their name, amount paid and email address on the confirmation page.

    Reply
    1. Sam
      Sam October 2, 2015 at 1:10 am

      Hi David.

      Thanks for the snippet troubleshooting link. The download code button on it is not working. Can you please let me know when it is so I can then get my techie guy to have another look at this issue.

      Thanks. :-)

    2. David Smith
      David Smith Staff October 2, 2015 at 7:22 am

      Hi Sam, I’m not seeing this snippet included in your functions.php. I did a search for “GW_Post_Content_Merge_Tags” within your functions.php but it returned zero results. Have you installed this snippet via another method?

  42. Vishal
    Vishal August 31, 2015 at 6:42 pm

    Hi David,

    Can this be used in woocommerce order emails as well?? I am using woocommerce gravity form addon which integrates gravity forms with woocommerce and want to make the new order email more personalized using gravity forms data.

    Regards, Vishal

    Reply
    1. David Smith
      David Smith Staff September 8, 2015 at 1:32 am

      Hi Vishal, this only applies to content in your posts. It would require additional code to support WooCommerce notifications.

  43. Brandon Shutter
    Brandon Shutter August 18, 2015 at 12:51 pm

    Is there a way to use this with Gravity Forms Quiz Addon? By default, there isn’t a merge tag for the weighted score of the item they pick, so I was wondering if you knew of a way.

    Reply
  44. Therry
    Therry August 6, 2015 at 2:39 pm

    Hi David!

    Thanks for this snippet. It was very thoughtful of you to share this. I just have a question though. How do I use this code if I want to pass only one data from one of the fields in the form? From what I understood, your code does get all the data from all the fields and pass it to the page. What I wanted to do with our website is to pass only one data from one the fields to the redirection page. I’m hoping you could help me with that :) Thanks in advance!

    Reply
    1. David Smith
      David Smith Staff August 7, 2015 at 9:20 am

      Hi Therry, I would just use this snippet as is. You could configure the redirect URL to only pass a single variable but then you would still need to figure out a way to get that variable and output it in your content. This snippet handles all of that for you. Is there a reason you don’t want to just pass the entry ID? You’ll still have access to the one bit of information you need and there is no significant draw back to this approach.

  45. Therry
    Therry August 5, 2015 at 12:13 am

    Hi, David! What does the numbers represent in these lines of code?

    Like what does 1 represent/mean in the first line, 10 and 3 on the 3rd line, and 20 and 3 on the 5th line?

    add_filter( 'the_content', array( $this, 'replace_merge_tags' ), 1 ); add_filter( 'gform_replace_merge_tags', array( $this, 'replace_encrypt_entry_id_merge_tag' ), 10, 3 );

        if( ! empty( $this->_args['auto_append_eid'] ) ) {
            add_filter( 'gform_confirmation', array( $this, 'append_eid_parameter' ), 20, 3 );
        }
    

    Thanks! :D

    Reply
    1. David Smith
      David Smith Staff August 7, 2015 at 9:30 am

      Hi Therry,

      add_filter( 'the_content', array( $this, 'replace_merge_tags' ), 1 );
      

      The “1” here represents the priority. This will run before all other functions bound to this hook because the priority is set to 1.

      add_filter( 'gform_replace_merge_tags', array( $this, 'replace_encrypt_entry_id_merge_tag' ), 10, 3 );
      

      The “3” here represents the parameter count. This is the number of parameters the filter should pass to the bound function. Each filter has a set number of parameters that it can pass. If there were 5 parameters it could pass, and I only needed the first 3, I would just enter the “3” here so that those three parameters would be passed to my bound function.

  46. Alex Wehmeyer
    Alex Wehmeyer August 4, 2015 at 6:06 pm

    Hi David, Thanks for that awesome snippet. Only took a couple of minutes to integrate this into my website. Unfortunately I have a problem while using the encrypted eid. I’ve set the value for encrypt_id to true. I can also see the encrypted eid in the query string as parameter. However the merge tags aren’t working any more. If I turn the encryption off again, the tags are working.

    Here is a link: http://wthannover.de/probetraining/probetraining-success/?eid=3X83grvvlWFSqbC7I89hIQ%3D%3D (Sorry texts are german).

    Could you help? Thanks! Alex

    Reply
    1. David Smith
      David Smith Staff August 4, 2015 at 7:29 pm

      Hi Alex, does this happen for every encrypted entry ID or just some? Any chance you could send me a WP login and FTP access so I can take a closer look (david[at]gravitywiz[dot]com)? I haven’t been able to recreate on my end.

  47. Sid
    Sid August 4, 2015 at 3:59 pm

    Hi There,

    Thanks in advance for your help and assistance.

    I’ve been using the coding here and it has worked for me since February this year. However, for some reason my confirmation page is not displaying the inputted date anymore and shows instead the short codes. Any advice?

    I did remove/reinstall Gravity Forms recently… maybe that is why?

    Reply
    1. David Smith
      David Smith Staff August 4, 2015 at 5:15 pm

      Hi Sid, I’ve confirmed the demo is still working with the latest version of Gravity Forms. Could you try reinstalling the snippet?

  48. Vic Dorfman
    Vic Dorfman July 26, 2015 at 4:45 am

    David, this kicks serious ass! The variety of applications is just mind boggling…

    One question for you:

    Am I correct in thinking that I can now basically personalize any page so long as I pass the appropriate values in the URL?

    If, for example, I collect some info via a Gravity form (Name, Email, Age) and then pass that info to my autoresponder (Aweber), then send out a broadcast to my subscribers with a link that, if clicked, has their info passed in the URL query string, it will allow me to basically personalize any and all pages on my site…?

    Basically, I’m looking for the ability to totally and ubiquitously personalize my site (and to take over the world….! :P

    Thanks!

    Vic Dorfman – Membership Site Expert

    Reply
    1. David Smith
      David Smith Staff July 27, 2015 at 12:36 am

      Yup, you’ve got the gist of it. :)

      I’d love to see what you end up doing with it!

    2. Vic Dorfman
      Vic Dorfman July 30, 2015 at 4:45 am

      Hey David,

      I just implemented this but one issue:

      How do I pass the EID that’s auto-appended to the query string URL to Aweber?

      The EID seems to get created/appended to the URL after the form submission, so how can I pass that value to Aweber?

      (Otherwise, when I bring Aweber subscribers back to my site at a later date without the EID tagged onto the end of the URL, none of the personalization will render)!

      Best, Vic

    3. Vic Dorfman
      Vic Dorfman August 13, 2015 at 12:19 am

      Hi Jordan,

      Did you see my question above about passing the EID to Aweber?

      This functionality is crucial to being able to run surveys (e.g. Ask Funnel type sequences).

      I’ll be happy to pay you for your time to answer this question/help me implement.

      Just wanted to make sure you saw it. :)

      Best Wishes, Vic Dorfman – Membership Site Expert

  49. jason
    jason July 7, 2015 at 4:40 pm

    nice snippet, thanks for this!

    one suggestion for this page – in the screenshot/step 4 for the form confirmation settings, it would be helpful for more novice users if it showed/covered selecting the pass field data toggle along with an example query string in the field…

    Reply
    1. David Smith
      David Smith Staff July 7, 2015 at 7:05 pm

      I’d love to make this easier for novice users. Could you elaborate on what your suggestion? I didn’t quite follow.

  50. Endtone
    Endtone June 11, 2015 at 6:32 pm

    Hi, First of all, thanks for the script. Exactly what I needed!

    Following your advice, I am trying to use this with “Admin label” for reusing the same confirmation page with multiple forms. It works fine, except the “Name” field. Using the “admin label” without the field_id does not work.

    example:

    Field Label: Your Name Admin Label : contactname

    {Your Name (First)} – Works {Your Name (First):17.3} – Works {contactname (First):17.3} – Works {contactname (First)} – Not working

    Reply
  51. Mike
    Mike May 28, 2015 at 11:35 am

    I placed your code into my child-theme’s functions.php file and I get an error that says:

    Parse error: syntax error, unexpected ‘<‘ in ______public_html/wp-content/themes/salient-child/functions.php on line 8

    I tried installing it as a plugin and also got the same error.

    Reply
  52. Pat
    Pat April 15, 2015 at 5:16 am

    Thsis isgreat! however we’re having trouble styling the output. the tags wont appear to accept any styling in the backend. Ive tried adding css to the style.css and it gets overridden by something. I added !important tags and they also get ignored or overridden.

    ANy suggestions would be great.

    Reply
    1. David Smith
      David Smith Staff March 31, 2015 at 9:26 am

      Absolutely. The only catch is that with these two snippets alone you would not be able to fetch the invoice based on the invoice number, it would still require the entry ID (or encrypted entry ID) in the URL. On the page itself, you could show any data you want, including the invoice number. :)

    2. Chris Wiggins
      Chris Wiggins March 31, 2015 at 3:14 pm

      Hi David, thanks for the reply. After the form has been submitted I have it going to an invoice page with the eid number. But if I manually goto the url after it has been submitted then the data isnt being displayed.

  53. Cameron
    Cameron March 20, 2015 at 8:36 am

    I am a boof head! I pasted the entire code into the php file, including the php tag so there was a double tag.

    Deleted the tag and works a treat. You rock thank you thank you thank you, such a great tool

    Reply
  54. Cameron
    Cameron March 20, 2015 at 8:01 am

    Hi, I used the code and pasted into the theme functions.php but kept coming up with syntax errors: (Parse error: syntax error, unexpected ‘<‘ in /home/quit/public_html/wp-content/themes/Divi/functions.php on line 236)

    Maybe I am not pasting it in the right section of the file, any thoughts?

    Kindest Regards Cameron

    Reply
    1. Vic Dorfman
      Vic Dorfman July 31, 2015 at 3:47 am

      Hey Chris,

      I, too, have tried using the merge tags in an HTML block after passing survey data from one gravity form to another.

      But I couldn’t get the merge tags to render, even though I was able to get merge tags to work on the same page OUTSIDE of the GravityForms HTML blocks.

      You can see it in action here – http://www.vicdorfman.com/membership-site-quotient which then passes the data to http://www.vicdorfman.com/my-msq-results

      Let me know if you find a solution!

      Best, Vic

    2. David Smith
      David Smith Staff July 31, 2015 at 6:32 am

      Hi Vic, does all that content need to be inside a Gravity Form? I’d recommend putting it in the actual page content and then if you need a form on the page, including that as well.

    3. Vic Dorfman
      Vic Dorfman July 31, 2015 at 11:14 am

      @David

      I’m using conditional logic to serve different HTML blocks in the gravity form on the second page based on replies on the first page’s form.

      So I’m not sure how I’d do that without using Gravity Forms and I’m guessing that’s what Chris is using it for as well.

      Vic

  55. Tim Strifler
    Tim Strifler March 2, 2015 at 2:41 pm

    Gravity Forms Support just pointed me to this article, and this is exactly what I was looking for. Thanks!

    Reply
  56. John C.
    John C. March 2, 2015 at 2:39 pm

    Wow this is such a great post. I was wondering if you could help me with this issue, which I think/hope is simple.

    I’m using a referral service, and when someone fills out a Gravity form, I’m being told I need to capture their email address as a variable. My exact instructions from the referral company are as follows:

    “Integrate that snippet on the ‘success page’ of the homeowner’s quote submission form on Chris’s site. You’ll need to dynamically populate the ‘mbsy_email’ variable so it corresponds with the new lead’s information.”

    The snippet in question is:

    <!– var mbsy_username='centralpenninsurance'; // Required var mbsy_campaign_uid='34568'; // Required; Example for multiple campaigns: var mbsy_campaign_uid='0000,0001'; var mbsy_email=’example@example.com’; // Required – must be replaced with your customer’s email var mbsy_revenue=’0.00′; // Optional – must be replaced with your revenue //–>

    Any idea how to capture the customer’s email address when they enter it?

    Thanks,

    John

    Reply
    1. David Smith
      David Smith Staff March 2, 2015 at 4:37 pm

      Assuming you are collecting the users email address on the form, when the user submits the form, you can use the field merge tag of the Email field to populate the email in the snippet. So mbsy_email='example@example.com' might become something like mbsy_email='{Email:1}'.

    2. John Cookson
      John Cookson March 3, 2015 at 10:33 am

      Wow, thanks…so the email is definitely getting pulled through with the code you provided. Now one last question….I’m supposed to insert that snippet on the “Success” page after some fills out a form.

      I tried copying and pasting the snippet in the Confirmations screen on the Form Settings, but it I know that is not the correct place to put it because it’s not enerating a referral for me.

      Can you tell me where a tracking snippet needs to be placed after a “successful form completion”?

    3. David Smith
      David Smith Staff March 3, 2015 at 6:03 pm

      I would think the confirmation message or in the content of the confirmation page would be the appropriate places to put your referral snippet. I’d ping the referral company to see if there are any common issues or support they can provide.

  57. Steffan Hernandez (@SteffanHernandz)
    Steffan Hernandez (@SteffanHernandz) February 27, 2015 at 7:42 am

    This is excellent. Thank you so much!

    I do have a question.

    Is there a way to output text in place of a field that has no entry?

    Example:

    {‘Form Field Name:ID’} has no entry.

    I would like my confirmation page to display text such as ‘N/A’

    Please help!

    You Rock!

    Reply
  58. Mary Plummer
    Mary Plummer February 25, 2015 at 4:35 pm

    Working with your snippet and not able to get Text Areas and Address fields to work.

    Here is what we have in the text editor. removed by admin

    Reply
    1. David Smith
      David Smith Staff February 25, 2015 at 10:30 pm

      Hi Mary, Gravity Forms does not support outputting the address via a single merge tag. Instead, you have to output each input merge tag like so. This is definitely something I will consider adding support for in the future.

  59. Mansur
    Mansur February 22, 2015 at 8:37 am
    Hi Mansur, you should be able to use a regular ‘ol ampersand like so: [gravityforms id="115" field_values="param1=value1&param2=value2"]

    Yes I know that but the problem is value1 doesn’t output the ampersand.

    for example let say actual value of value1 is ‘one&two’

    field_values=”param1={value1}” is became param1=”one&two” and make it conflict.

    It should be param1=”one&two”

    I want your merge tag code should able to output decoded html special character of actual value in database

    Reply
  60. Mansur
    Mansur February 21, 2015 at 9:12 pm

    Hi.. thanks for great snippet.

    I Installed this snippet and it is working great… without any problem..

    I just want ask about how to encode special character to outputed merge tag. I want to encode ‘&’ character to #26.

    I need this because i want prepopulate via gravity form shortcode ‘field_values’ query string. Query string doesn’t support value contain ‘&’ output that’s why need to convert to #26 Ascii.

    notes : dynamic population working great for the value that contain no ‘&’ character. The only problem occur when value exist ‘&’ character in the value.

    Example: [gravityform id=1 field_values='parameter_name1={ItemsValue1}&parameter_name2={ItemsValue2}']

    Reply
    1. David Smith
      David Smith Staff February 22, 2015 at 7:34 am

      Hi Mansur, you should be able to use a regular ‘ol ampersand like so: [gravityforms id="115" field_values="param1=value1&param2=value2"]

  61. Keely
    Keely February 21, 2015 at 1:01 am

    Added snippet to functions file (pasted from Notepad) and I get an error:

    Fatal error: Call to undefined function gw_post_content_merge_tags() in ….. functions.php

    Not sure what I’m doing wrong?

    Reply
  62. Ben
    Ben February 14, 2015 at 12:09 pm

    I cannot figure out how to get the {embed_post:post_title} to show the title from the previous page where the form is located. It show the title of the redirect page. I saw the earlier comment about the URL and {entry:source_url} but I’m still lost. Can you please help me figure this out?

    Reply
    1. David Smith
      David Smith Staff February 14, 2015 at 8:32 pm

      Hi Ben, the issue is that the {embed_post} merge tag is based on the current post and not the post from which the form is submitted. So if you have it on the form page, it will show the page the form is embedded on but if you have it on another page using this snippet, it will show the current page that it was rendered on.

      The solution is to capture the embed post title in the entry. You can do this like so:

      1. Add a new Hidden field to your form.
      2. Set the Default Value of the Hidden field to {embed_post:post_title}.
      3. Now use the merge tag for the field on the page were you’re using the Post Content merge tags.
    1. David Smith
      David Smith Staff February 11, 2015 at 10:04 pm

      Hi Brett, I’m not seeing the “eid” parameter appended to your thank you page URL when I was redirected. Did you override the “auto_append_eid” parameter when you installed the snippet? If not, it should be automatically appended. You shouldn’t have to pass any other details via the query string. The snippet picks up the entry ID from the “eid” parameter and then can look up any details about the entry.

  63. Raj
    Raj January 21, 2015 at 9:42 am

    How do I place the tags in a template-xx.php

    The is working if I use the backend admin page, but if i pasta the tag in the php code it does not.

    Thanks for your help

    Reply
  64. kalle
    kalle January 12, 2015 at 12:54 am

    Hey,

    great snippet.

    Is there any way to get the info tag to work on custom fields? For example I would like to get one field and pass it to yoost WordPress SEO plugin field (to desctiption field). At the moment it just prints the {name} tag there.

    Reply
    1. David Smith
      David Smith Staff January 12, 2015 at 1:22 pm

      Hi Kalle, not sure I’m following. Are you attempting to use this snippet to populate a custom field?

  65. Nitin M
    Nitin M January 7, 2015 at 10:42 am

    Hello David, Very helpful article. I am able to take care of dynamically putting text inside HTML on Thank you page.

    For HTML – Even if I don’t pass all values in querystring, it is able read values using ‘eid’ For Eg : {Location} inside HTML displays correct value

    However on this thank you Page, I have another form with several fields. How do I dynamically populate them ? What do i put inside Advance–>Parameter name {Location} doesnt work here. Location or ‘location’ also doesn’t work

    ‘location’ will work only if I also pass this in querystring.

    To summarize – I am able to display all values inside HTML without passing all parameters but I cannot popular text boxes unless I pass them in querystring

    Reply
  66. Martin
    Martin December 12, 2014 at 1:05 am

    Hello Jordan,

    I tried your demo site and it does not seem to work. The confirmation message just displays the merge tag placeholders (“Greetings {Name (First)},

    Thank you for contacting us! We look forward to helping you make you wildest dreams come true. Your confirmation ID is 5. An email with important, dream-related information has been sent to {Email}.”)

    I have the same problem on my site though so now I now I am not alone.

    Reply
    1. David Smith
      David Smith Staff December 22, 2014 at 10:05 pm

      Hi Martin, I’ve updated the demos site to the latest version. Remember to always get the snippet code form the “raw” version as it will sometimes contain updates not yet reflected on the syntax highlighted version (which is cached).

  67. Arlo
    Arlo December 11, 2014 at 4:23 am

    Hi

    I have a form which ask for a market value estimate of their house (number field, currency, £ sterling). When the form is submitted, I want to redirect to a new page which dynamically populates from the form fields submitted.

    The new page will basically be an automated ‘offer to purchase’ and I want it to apply a formula to the market value (MV) submitted. Merge fields in brackets below. For example, it will say:

    “(First Name), our quick sale cash price offer for (Address 1) would be somewhere between (MV x0.75) to (MV x0.80), based on the information you have. (Town) also qualifies for another home sale option achieving (MV 0.85) to (MV x0.95), however the timeframe would most likely be longer than 4 weeks. Etc”

    So if they entered 100,000, then the first line would be: “…somewhere between £75,000 and £80,000” etc.

    Is this possible with Gravity Forms, would I be able to do it or should I look to hire someone?

    Your help would be much appreciated.

    Thanks

    Reply
  68. brian
    brian December 5, 2014 at 12:55 pm

    I’m trying to configure a redirect after form submission in the Confirmation settings. To be more precise I want the new page (to where it’s going to re-direct after submission) to open in a new window. Just like you have the tag target=”_blank” you can use in the a href link.

    Any ideas how to do this?

    Thanks

    Reply
  69. Paul
    Paul November 25, 2014 at 1:56 pm

    Hi, do you have a snippet or perk where a merge tag from a calculated number field can be used as a conditional value for greater than? I’ve got html that I want to display if the total of five fields is greater than the value of another. Any thoughts? Thanks in advance for the info. By the way, this site is very helpful!

    Reply
  70. Evgeni
    Evgeni November 23, 2014 at 2:44 pm

    What an excellent extension to the GF plugin. Thank you. I have implemented content-merge-tags as described and it works fine. Nonetheless the eid is displayed and I want to enable the encrypt_eid but it seems to ‘crash’ the thank you page. When I have: ‘auto_append_eid’ => true, ‘encrypt_eid’ => true, The thank you page is completely blank – i.e. no html gets sent back from WP. If I try to invoke the thank-you page just from my browser (i.e. not via the form) it works fine. Thanks!!

    Reply
  71. Ton
    Ton November 19, 2014 at 2:16 pm

    Dear David,

    First of all I would like to thank you for making this awesome peace of code available to the Gravity Forms community !

    When experimenting with your code I encountered a serious security breach.

    It seems possible for people visiting the website to read all previous posts done by other people by simply entering an integer value for the ‘eid’ parameter (when encrypt_eid is set to true) . You can reproduce this behavior on your demo site.

    I would have expected that when one sets the ‘ encrypt_eid ‘ to ‘true’, it would only be possible to use an encrypted value for the ‘eid’ parameter. Unfortunately, the code still accepts an integer value while encrypt_eid is true ….. and thus opening a backdoor for reading all posted data.

    Hope this makes sense !

    Reply
  72. Jamie Larson
    Jamie Larson November 14, 2014 at 11:48 am

    I’m pasting this in my confirmation page and it shows up exactly the same. (it just shows the code, like {Name… , not the actual data entered by someone completing the form.)

    What am I missing?

    Thank you for entering. {Name (First):10.3} {Name (Last):10.6} {Street Address (No PO Boxes accepted.) (Street Address):9.1} {Street Address (No PO Boxes accepted.) (City):9.3}, {Street Address (No PO Boxes accepted.) (State / Province):9.4} {Street Address (No PO Boxes accepted.) (ZIP / Postal Code):9.5} {Phone:11} {Age:8}

    Reply
  73. Greg
    Greg November 12, 2014 at 12:46 pm

    Looks like a great snippet – hoping to work this into a survey result page with dynamic content based on the answers. Are there any conditional options/support for merge tags? It would be awesome to have math/conditional functionality. Something like:

    [if {score:id=1} > 1] Conditional output [endif]

    Reply
    1. Greg
      Greg November 12, 2014 at 3:37 pm

      I’ll give that a shot – was not sure if the conditional merge tags would be supported outside of the default GF Notification/Confirmation areas…

  74. Todd
    Todd November 6, 2014 at 10:26 pm

    This is a swell snippet, thank you for sharing it!

    I’m having an odd problem with my confirmation page. /thank-you/eid=123 is nicely pulling in the entrie’s name and email, but NOT the {embed_url}. I’d like to link the {form_title} back to the page it’s embedded on so the user can go back and read the page, but the link is pulling in the confirmation page instead.

    Am I missing something obvious here?

    Reply
    1. David Smith
      David Smith Staff November 7, 2014 at 7:10 am

      The issue is, GF doesn’t pull the {embed_url} from the submitted entry but rather the current embed URL on which the merge tag is generated. Here is another snippet that adds a bunch of new merge tag functionality to Gravity Forms:

      https://gist.github.com/spivurno/5850937

      One of these is the ability to retrieve any entry property. In your case, you’re looking for the “source_url”:

      {entry:source_url}

      Copy and paste the above snippet into your theme’s functions.php file and then just use that merge tag wherever you want to generate the URL from which the entry was submitted.

    1. Jordan Smith
      Jordan Smith October 27, 2014 at 4:00 am

      Hi Eric,

      Not sure I follow. Descriptions output beneath the fields by default. Could you give me a little more information about your setup and how you are using this snippet? Thanks!

    2. Eric
      Eric October 27, 2014 at 4:11 am

      I am trying to display some fields on a confirmation page. For instance, 1 field is a physical address. In the description of that field is a map with a link to the address.

      So, on the confirmation page I have the merge tag but the tag does not show the description of the field thus leaving out the map with a link.

      I hope that makes sense, thanks!

  75. Mark
    Mark October 19, 2014 at 12:27 pm

    I can’t seem to get this to work. I just get a blank page when I submit the form and the browser console shows a 500 server error.

    Do I just cut/paste your code and append it to the bottom of the theme’s functions.php file?

    When I remove your code from functions.php, the form submits fine and my thankyou page shows up .

    Btw, I’ve tried it with and without the eid code change and passing the eid variable through the query string.

    Reply
  76. Chris Awad
    Chris Awad September 24, 2014 at 3:30 pm

    Awesome snippet, the encrypted eid is exactly what I was looking for! Is there anyway to disable the eid to appear if the user enters the unencrypted id in the url?

    Reply
    1. David Smith
      David Smith Staff September 25, 2014 at 12:30 am

      Hi Chris, do you mean that if they manually include the “eid” parameter in their confirmation redirect to not automatically append it? If so, just set the “auto_append_eid” parameter to false.

      gw_post_content_merge_tags( array(
          'auto_append_eid' => false
      ) );

  77. Alex
    Alex September 22, 2014 at 3:12 pm

    Hello, I followed the instructions and watched the video yet for whatever reason I’m not able to get the confirmation page to work – any suggestions ? Anything I could have overlooked ?

    Reply
  78. Diane
    Diane September 17, 2014 at 6:11 am

    Do you know if there is a way to show the day instead of a full date in an entry field ? For example I am using your tutorial above and the client is buying a subscription. I want to let them know that a reoccurring payment will happen on or around the 15th or whatever day they complete the form.

    Reply
    1. David Smith
      David Smith Staff September 17, 2014 at 11:23 pm

      Hi Diane, could you elaborate on the logic used to determine what day the payment would be and whether you’re looking to display the day as in the “15th” or “Tuesday” or something different?

  79. Weekly Roundup: September 5, 2014 - Sell with WP September 5, 2014 at 2:00 am

    […] using EDD and Gravity Forms together last week, and Gravity Wiz posted an awesome tutorial on using merge tags in post content that can help you take your confirmation messages to the next […]

    Reply
  80. Michael
    Michael September 4, 2014 at 5:29 pm

    I’m creating a receipt page outside of WordPress (I don’t want the header, nav. etc. on the receipt page).

    I placed the above code in my functions.php file and created a receipt page (http://www.familyradio.org/receipt/receipt.php) with first and last name fields {Name (First):1.3}{Name (Last):1.6}

    Gravity Forms confirmation is set to redirect, selected “Pass Field Data Via Query String”, and added first and last name fields.

    The redirects to: http://www.familyradio.org/receipt/receipt.php

    I get a blank page with the first and last name in the url. I’m missing something simple here, I’m sure. Any suggestions??

    Thank you!

    Reply
    1. David Smith
      David Smith Staff September 5, 2014 at 11:00 am

      Hi Michael,

      With this snippet, you don’t need to pass the individual fields. If you have “auto_enable_eid” enabled (it is by default with this snippet), the entry ID will automatically be appended to the confirmation redirect URL via the “eid” parameter.

      I suspect the issue is that this functionality replaces the merge tags on the “the_content” filter, which is applied by default to the content of WordPress posts and pages. If you’re page is running outside of WordPress, this filter is probably not being applied and therefore the merge tags as not being replaced.

  81. diane laidlaw
    diane laidlaw August 30, 2014 at 12:07 pm

    Thank you so much for this. Needed this information. I was wondering if you can possibly do a tutorial showing people how to make a fill in the blanks form. You know the ones where it says hello my name is ______________ and I want to order a _______________ website . My budget is _____________.

    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 Snippet

Use Gravity Forms Merge Tags in Your Post Content

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