August 31, 2023: Added support for using specific inputs in the
:filter
modifier.May 2, 2023: Added support for parsing modifiers that include underscores (e.g.
:my_custom_modifier
).February 9, 2022: Fixed issue where Signature field images would not show if using the
:filter
modifier and GF Signature 4.0 or newer.January 19, 2022: Added support for excluding Consent field descriptions using the
:exclude
modifier.November 3, 2021: Added support for excluding specific child fields from a Nested Form field via the
:exclude
modifier.October 1, 2021: Added the
gwaft_template_paths
filter to allow filtering the available template paths including adding a custom path.June 16, 2021: Fixed an issue where
nopricingfields
may still show "Order Summary" label when other modifiers are used.June 14, 2021: Fixed an issue where "Order Summary" label would still appear when using
nopricingfields
modifier.April 16, 2021: Added support for filtering via custom function.
November 9, 2020: Added support for excluding specific inputs of multi-input fields via the
:exclude
modifier.November 3, 2020: Migrated snippet to the Snippet Library.
January 27, 2020: Added
:nopricingfields
modifier to hide pricing fields from{all_fields}
output.September 5, 2019: Fixed notices generated in PHP7.3 by
continue
statements inside a foreach/switch.April 11, 2019: Updated priority of template replacement to avoid conflict with other merge tags replacement plugins.
The Gravity Forms {all_fields}
merge tag provides a super simple way to output all of the submitted form data but it’s notoriously difficult to customize.
This simple Gravity Forms plugin provides templating support for the {all_fields}
merge tag. Huh? It means you can replace the markup generated by the merge tag with the contents of a file. This tutorial offers a solid starter template file too!
Getting Started
This tutorial assumes you’re running a recent version of Gravity Forms, that you already have the {all_fields}
merge tag implemented wherever you want, and that you ♥ Gravity Wiz.
![]() |
Download, install, and activate the plugin. |
![]() |
Download the sample template directory/file. Add the folder to your active theme’s root directory: /wp-content/themes/{your-theme}/
|
![]() |
Customize the template as desired. |
Template and Merge Tag Options
This plugin provides a few handy modifiers for controlling which template will be used to render the {all_fields}
merge tag.
Note: All template paths are relative to your theme’s root directory.
Default Templates
Merge Tag | Template |
---|---|
{all_fields} | /gravity-forms/all-fields.php |
Form-specific Template
Providing a form-specific template requires no changes to the merge tag. Simply append the targeted form ID to your template’s name. This template will now only be used when the merge tag is used in the context of the specified form.
Merge Tag | Template |
---|---|
{all_fields} | /gravity-forms/all-fields.php /gravity-forms/all-fields-1.php |
Custom Template
You may want to create a custom template that should only be applied to specific instances of the merge tag. The “template” modifier allows you to specify a custom template suffix.
Merge Tag | Template |
---|---|
{all_fields:template[custom]} | /gravity-forms/all-fields-{template}.php /gravity-forms/all-fields-custom.php |
No Template
You may want to create a generic template that applies to all instances of the merge tag by default and then disable that template to use the default Gravity Forms merge tag output in a few specific instances.
Merge Tag | Template |
---|---|
{all_fields:notemplate} | No template |
Hide Pricing Fields
Hide pricing fields (i.e. order summary) from the {all_fields}
output.
Merge Tag | Template |
---|---|
{all_fields:nopricingfields} | Hide pricing fields |
Field Filtering Modifier
These modifiers allow you to control which fields are output in the {all_fields}
merge tag without having to touch any code.
Please note: you only need the plugin installed to use these modifiers. You do not need to install the template files in your theme.
Merge Tag | Description |
---|---|
{all_fields:include[1,2]} | Include a field that is not included by default (i.e. HTML fields). |
{all_fields:exclude[3,4]} | Exclude a field that is included by default. |
{all_fields:filter[1,2]} | Only include the specified field IDs. This takes precedence over both the ‘include’ and ‘exclude’ modifiers. |
{all_fields:include[1,2],exclude[3]} | The :include and :exclude modifiers can be combined. |
GF Nested Forms Support
To filter which fields from a child form display in your {all_fields}
merge tag you can use the :filter modifier and the [Nested Form Field ID].[Child Field ID] format (e.g., 4.3; where 4 is the Nested Form field ID and 3 is the child field ID from the child form).
You can use the :include, :exclude, :filter, and :index modifiers on the Nested Form field to filter which child fields should be displayed.
Merge Tag | Description |
---|---|
{all_fields:filter[1,2,3.4,3.5]} | In this example, 1 and 2 are field IDs on the parent form. 3 is the Nested Form Field ID and 4 and 5 are field IDs on the child form. |
{all_fields:exclude[3.4,3.5]} | In this example, 3 is the Nested Form field ID and 4 and 5 are field IDs on the child form. |
{Nested Form:1:filter[4,5]} | Show fields 4 and 5 from the child form for this Nested Form field. |
{Nested Form:1:index[0],filter[1]} | Show field 1 in the first child entry from the child form. :index must be paired with :filter. |
{Nested Form:1:index[-1],filter[1]}
to target the last entry and display the value from field 1.Excluding Specific Inputs Within a Field
Fields that contain multiple inputs, such as the Name field, can be excluded per-input by specifying the input ID. For example, to exclude the First Name, add .3
to the Field ID (e.g., 5.3; where 5 is the Name field).
This works for any field that contains multiple inputs, such as Name, Address, and Product. You can find the specific input IDs in Gravity Forms Documentation for Name and Address fields.
Merge Tag | Description |
---|---|
{all_fields:exclude[5.3]} | In this example, 5 is the field ID of a Name field. 3 is the First Name input ID. |
Filter and Exclude Via Custom Function
Custom functions can be used to identify fields for filtering. Using a custom modifier, the function should return an array of field IDs. For example, if you want to exclude fields with personal information from some instances of the {all_fields}
merge tag, you could specify a custom modifier value like so:
{all_fields:exclude[persInfoFields]}
And then create a custom function to identify the IDs of those fields.
add_filter( 'gwaft_modifier_value_persInfoFields', function() {
return array( 1, 2, 3 );
} );
Merge Tag | Description |
---|---|
{all_fields:exclude[customFunction]} | Exclude fields that are returned via customFunction. |
{all_fields:filter[customFunction]} | Show fields that are returned via customFunction. |
This is useful in circumstances when you need to use the {all_fields}
merge tag in multiple places and want to exclude the same fields in several contexts. Instead of having to copy the same string of field IDs to every place you’ve inserted the {all_fields}
merge tag, you can specify the custom function once and use the custom filter wherever you need it. If you want change or add to the excluded fields in the future, you simply update the custom filter and it will be applied everywhere the filter is used.
Customizing the Template
Ok, don’t let this section intimidate you. Here’s the TLDR; Loop through $items
, use $item['label']
for the field label, and $item['value']
for the field value. Here’s the simplest template you could have:
<ul>
<?php foreach( $items as $item ): ?>
<li>
<strong><?php echo $item['label']; ?><strong><br>
<?php echo $item['value']; ?>
</li>
<?php endforeach; ?>
</ul>
You’ll most likely want to use the sample template above as a starting point though as it takes care of a requirements to better align the template with Gravity Forms default All Fields functionality.
Digging Deeper
The {all_fields}
template works like any other WordPress template with one exception. There is a special $items
array available to you.
Each $item
contains a label, value, and field property. The label and value are the exact label and value that the default {all_fields}
merge tag would output. The field is the input-type-specific GF_Field object for the current field. This is useful when you want to alter the way a field is displayed depending on the field you’re working with.
Lastly, you have access to the current entry via the $entry
variable and the current form via the $form
variable. For more details on these variables, see the parameters section below.
Parameters
$items array
An array of items, each item containing the Gravity-Forms-formatted field label, field value and field object for the given field. The field label and field value are the same values that Gravity Forms outputs in the default
{all_fields}
merge tag.$entry Entry Object
The current Gravity Forms Entry object.
$form Form Object
The current Gravity Forms Form object.
Doing more with Gravity Forms
Okay, so with this plugin you can easily handle {all_fields}
data. But what if you just don’t feel you’ve got enough different fields in your Gravity Forms? What if you want to export more fields? That’s where Gravity Perks comes in. Gravity Perks is an essential bundle of 34+ WordPress plugins that add new features for Gravity Forms. Plugins such as…
GP eCommerce Fields
With the GF eCommerce Fields plugin you can easily add eCommerce field types to your Gravity Forms. The new pricing fields include Discount, Tax, and Subtotal. This plugin also improves upon the functionality of Gravity Forms’ Coupons and Shipping fields.
GF eCommerce also adds support for special merge tags for including the subtotal, coupon and conditional-logic-based discount amounts in calculation-enabled fields along with a handy merge tag for displaying the order summary in your confirmations and notifications.
It’s great for helping your users better understand their orders by showing the subtotal before shipping, coupons and taxes have been applied – avoiding any nasty surprises at checkout!
GP Easy Passthrough
Easy Passthrough simplifies transferring entry data from one Gravity Forms form to another. Instead of spending time setting up dynamic parameter names and customizing confirmation query strings, you can passthrough data by setting up an Easy Passthrough configuration.
Entry data is transferred across multiple sessions using the special Easy Passthrough token. This token is a secret key, unique to each entry, preventing random users from guessing at the token and passing through entries they should not have access to.
GP Post Content Merge Tags
This plugin allows you to include Gravity Forms merge tags in WordPress post content, allowing you to, for example
- 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.
- 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.
- Reclaim complete control over the styling of the redirect page while maintaining the ability to use Gravity Forms merge tags in the content of the page.
These are just 3 of the 34+ plugins in the Gravity Perks collection. Check out the full set of plugins and see what Gravity Perks can do for you today!
FAQs
How do I hide Hidden fields from the {all_fields} merge tag?
You can use the :nohidden
merge tag modifier on the merge tag like this:
{all_fields:nohidden}
:nohidden
hides field output of fields using the Hidden field type. It doesn’t affect to fields set to a Visibility of Hidden.How can I translate the Order Summary label?
You can set a custom Order Summary label using the gwaft_order_summary_label
filter.
add_filter( 'gwaft_order_summary_label', function() {
return 'My Custom Order Summary Label';
} );
Hooks
Questions? Feedback?
What questions do you have? What features are missing? We’d like to make this into a more robust plugin and your feedback will be a big part of shaping the final product.
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 47+ essential add-ons for Gravity Forms with support you can count on.
How to hide two last table rows for “Total” and “Sub Total”, when a product field is on the form. I want to show product name and price in the order summary, but not the Total and Subtotal. I have separate fields for total calculation including Tax, so the default toal is not needed, and it actually shows the double amount because it sum up the calculated total field, and the default Total in the template.
Thanks
The All Fields Template can’t modify the order summary, but our eCommerce Fields Perk can. It adds support for custom order summary markup using this filter.
GP eCommerce Fields also adds support for Subtotal and Tax fields, which much supersede your need to omit the Total and Subtotal from the order summary, as they will properly integrate and calculate in the Order Summary.
Great plugin!
Is it possible to remove the ‘map it’ link from address fields that are displayed througb {all_fields}?
Many thanks!
Hi Kirsty,
The “Map it” link is actually a feature of the Gravity Forms Address field. You can remove that using this Gravity Forms filter.
https://docs.gravityforms.com/gform_disable_address_map_link/
I know this might be a silly question, but is it possible to embed individual MERGE tags in a template, instead of doing a loop for all? I know it makes the output static, but that isn’t a big concern at the moment, for me.
Hi Brett,
Merge tags won’t work if inserted directly within the template because the template uses PHP. You could, however, customize the template with PHP to display specific field values, similar to what a merge tag will do. If you have an active Gravity Perks license, you can contact us via our support form so can look into this further
Best,
I was wondering if you could advise how to get the content in the description to show up on the email too. I have everything working apart from that? I was wondering if I can email you to show you what is happening, as easier to explain than type in this comment box.
Hi Jenny,
If you’re referring to the field description as shown in the following screenshot, you can use
$item['field']['description']
to retrieve that value.Hi Scott, I can’t seem to reply to your message.
I currently have this in place
{all_fields:include[21,23,25,29,26,27,28,5,6,9,30,31,32]}
so where do I add the bit you are saying?
Hi Jenny,
You’ll need to create a custom template to implement this. I followed up with additional information via email.
Do you know if there is a way to include the custom template via a different method. I’d prefer to be able to add this via the Snippets plugin.
We’ve already followed up via email, you should be able to add different templates with different names and call each one only when needed using the Custom Template.
Best,
Hi, Thanks for greate job. I did all steps and every things work fine. But after updating the gravityform to the version 2.7.8, it does not work. Did you test it with the Gravityform v.2.7.8 ?
Best regards, Masu
Hi Masu,
I just tested with the latest version (2.7.10) and the All Fields Template works in all my tests. If you’re a Gravity Perks customer, drop us a line. We’ll be happy to troubleshoot this with you.
I have 2 html fields – header and footer. Issue is the notification is displaying both html fields first before any other field. I used the all fields code above with the html field id’s but that did not work. How can I manually add header html code first, then add other fields and then add the footer html tag?
Hi Bruno, this will probably require some customization of the All Fields Template. If you’re having trouble using the snippet and are a Gravity Perks Advanced or Pro customer, reach out to support. We’re happy to help.
Hi, thank you for this promising tool for free. I downloaded, installed, and activated the plugin. I unzipped the template file and uploaded it to the active child theme’s directory. I have the GF confirmation set to show {all_fields}. I’ve tested the form twice and it still shows the tragic GF default blue and plain box. What did I miss or do wrong?
Also, is there a way to use this template to send fill out the email confirmations/notifications so we don’t use the fugly GF all fields data box?
Hi Chris,
Is the sample template file located in
/wp-content/themes/{your-theme}/gravity-forms/
? The full path should look like this:/wp-content/themes/{your-theme}/gravity-forms/all-fields.php
The All Fields Template will replace all instances of the {all_fields} merge tag, including email confirmations and notifications.
Thank you, Scott!
I cannot reply to your message so I’m replying here to mine.
Previous, I followed the directions above for Step #2 Download the sample template directory/file. Add the folder to your active theme’s root directory: /wp-content/themes/{your-theme}/
I had uploaded the PHP file to the active theme folder.
This time I created the GF directory and put the PHP file in there:
/html/wp-content/themes/**********-child-theme/gravity-forms/all-fields.php
But when I submitted the forms I still got the GF all fields table :(
Thoughts? Chris
Hi Chris,
Do you also have the Gravity Forms All Fields Template plugin activated on your website? In addition to adding the all-fields.php template file in the Theme’s folder, you also need to download and install the GF All Fields Template plugin to get it working.
Best,
Samuel, thank you for your response. Yes, the plugin is installed and activated. This is a WPMU WordPress Multisite (network) so maybe the plugin does not work in this environment?
Hi Chris,
The All fields template plugin should work with WPMU. If you have an active Gravity Perks license, send us a message via our support form and we look into this further for you.
Best,
Your “provides a super simple way” is just misleading. This is far from easy. When you have to FTP files to the server and then work with PHP code – you can’t call it “easy”.
Sure I know how to do all this, but it is a pain in the butt.
But you are giving it away for free. So I am not complaining. But just saying, this is not easy.
Easy would be a UX dashboard, drag/drop interface, check boxes, WYSIWYG editor. That is easy. But having to upload to the server and customize PHP. This is not something ANY of my clients would do.
Just saying…
Hi Steve,
Thanks for the feedback. If you reread our opening sentence, it should be clear that we are referring to the
{all_fields}
merge tag being super simple. It is functional in its simplicity, but it doesn’t offer any customization.This plugin adds templating support for that merge tag. Unfortunately, custom templating isn’t simple by nature. We do have some merge tags that add capabilities for filtering without having to touch code, but the expectation is that you’re a developer if you’re writing fully custom templates. For your clients, we do offer support for our plugins. If you or they have a Gravity Wiz license, reach out to our support team, and we’ll gladly offer our guidance.
Hello, Is there a way to make this plugin work with Oxygen Builder ? Oxygen completely disables the WordPress theme system I do not know where to put the “all-fields.php” template.
Thanks
Hi Caroline,
Here’s a snippet that will let you add a custom template path. In this example, I’ve created a folder in the WordPress plugins folder titled “your-plugin”. In that folder, I have my all-fields.php template file.
add_filter( 'gwaft_template_paths', function( $file_paths ) { $file_paths[0] = WP_PLUGIN_DIR . '/your-plugin/'; return $file_paths; } );
This should get it working.
Best,
Does this plugin work with PHP 8.1? I just tried to install and got dumped to a 403 page. I haven’t checked the logs yet.. just thought I’d ask if it’s known-compatible with 8.1 or not.
Hi Mike,
I just tested with a PHP 8.1 installation and didn’t incur any errors. There’s likely something else at play. If you’re a Gravity Perks customer, drop us a line and we’ll be happy to dig into this.