Change Feed Priority When Using the Gravity Forms Add-On Framework

The Gravity Forms Add-On Framework is a great time-saver for developing your custom Gravity Forms functionality. In chatting with another developer, the question of adjusting the feed priority came up.

How can you control the order in which feeds are processed?

In this situation, they needed to save data in one feed and then use that data in another feed, so it was important that the feeds fire in a particular order.

If you’re using the Add-On Framework, you likely understand object-oriented programming concepts β€” especially inheritance β€” so this isn’t a difficult task at all. There are a few ways to handle this, but here’s a simple way:

public function init() {


			add_filter( 'gform_entry_post_save', array( $this, 'maybe_process_feed' ), 9, 2 );


Simply override the function that adds the filter to process the feed β€” GFFeedAddOn init β€” and add the filter with your desired priority.

In this example, we’re setting this particular Add-On’s feed to process *before* the ones with the default priority. It doesn’t affect the priority of any other Add-Ons.

Questions? Email Me

Make Gravity Forms Hidden Field a Certain Type

Sometimes you need to have some data on your form, but it needs to be hidden. Gravity Forms has a hidden field type β€” perfect! Or is it?

What if you need the field to be a certain type? Like a product field, or date field, or any other Gravity Forms field? A Gravity Forms hidden field is a basic text field β€” it doesn’t provide any formatting for a specific type of data like the other Gravity Forms fields. So how can you make a Gravity Forms hidden field be a certain type?

Well, you can’t. But, you can simply use whatever field type you want and then hide it with CSS. Every time I mention that to a client, they look at me, I look back at them, they look back at me…ok, you get it. I patiently allow them to go through the stages of their “why didn’t I think of that” moment πŸ˜‰

And, Gravity Forms does you aΒ big favor when it comes to common CSS adjustments β€” they provide ready-made classes that you can use on the Appearance tab of any Gravity Forms field, in the ‘Custom CSS Class’ box. So, to hide a field, simply use the gf_invisible class.

Hope that helped!

Questions? Email Me

Prevent a Field from Saving to the Gravity Forms Entry

For whatever reason, you may want to redact a Gravity Forms field β€” a fancy way of saying that you don’t want the data that your user enters in that field to be saved to the Gravity Forms entry that gets created when the form is submitted. This is particularly helpful when you have sensitive information that you need to collect and process, but you do *not* want to store it in your database. For example, you need the user to enter a billing address to send it to your payment processor, but afterwards you don’t want to save that information.

The Gravity Forms Utility plugin adds an option to each form field, allowing you to check a box to redact that field’s data, making sure it never gets saved to the entry. Note that the information is forever unrecoverable β€” so only use it if you mean it! gravity-forms-dont-save-field-data-to-database

Questions? Email Me

Setup Multiple Payment Options on One Gravity Form

How can I give users the choice of paying with PayPal or [another payment processor]?

This is a common question I get with the Gravity Forms + Stripe Add-On, but it applies to any other payment processor.

To accomplish this, you need one field to hold all of your possible choices and then you can use that field in your conditional logic. Here’s how we do it with Gravity Forms + Stripe:

  1. On your form, create a radio button field to allow your user to choose whether they will be paying with PayPal or Stripe (substitute your payment processor for Stripe if you’re using someone else)
    Gravity Forms Multiple Payment Options Radio Button Field
  2. Create your product field(s)
  3. Add your credit card field and enable conditional logic on this field, only showing the field if the person chose Stripe. Skip this step if your PayPal version accepts credit cards via the Gravity Forms credit card field, and/or if your other payment processor does not accept credit card payments (e.g. if you were using PayPal and Dwolla).
    Gravity Forms Credit Card Field Condition
  4. Create a Stripe rule and enable the Stripe condition on the rule so that it’s only triggered when the user selects the Stripe payment option
    Gravity Forms Stripe Payment Feed Conditional Logic
  5. Create a PayPal feed, and enable the PayPal condition on the feed so that it’s only triggered when the user selects PayPal

But what if I need recurring payments, too?

You’ll just expand your options. Instead of having only two options: Stripe and PayPal. You’d have four options:

  1. One-time payment (Credit Card)
  2. One-time payment (PayPal)
  3. Recurring payment (Credit Card)
  4. Recurring payment (PayPal)

And you’d be able to use those options on both your credit card field (if necessary) and in your one-time payment and recurring payment feeds (most Gravity Forms payment add-ons require separate feeds for one-time payments and subscription payments).
The key is that all of your options have to be in one field β€” you can’t split the options into multiple fields.

And here’s an example form you can download, unzip, and import into your site to see how it works right in your Gravity Forms form editor:


Questions? Email Me

Setup Gravity Forms Conditional Confirmation or Notification Messages Based on Submitted Values

Have you ever wanted to have your confirmation or notification messages say different things depending on the submitted values?

Take the form below as an example:
Gravity Forms Form Editor Radio Button Option Field

Based on which option the user chooses, I’d like to display a different message when they submit the form, and the Gravity Forms conditional shortcode is just what I’m looking for.

The Gravity Forms conditional shortcode allows you to show different content depending on the values of the submitted form fields. In my example, I have a different message for each option the user can choose:
Gravity Forms conditional confirmation message

So here’s how to use them:

  1. [gravityforms action="conditional"
    Start with the shortcode name and the action, which is always “conditional”
  2. merge_tag=""
    Add the form field that has the value you want to check. You can insert the merge tag for the form field using the merge tag dropdown. Gravity Forms Merge Tag Dropdown
  3. condition=""
    Indicate the type of comparison you will be doing. The possible conditions are is, isnot, greater_than, less_than, contains, starts_with, ends_with.
  4. value=""
    Enter the value that you want to compare the submitted value with.
  5. ]
    Close the opening shortcode.
  6. After you close the opening shortcode, enter your desired content for this condition
  7. [/gravityforms]
    Finally, enter the closing shortcode
Putting it all together, we have:
[gravityforms action="conditional" merge_tag="{Field:1}" condition="is" value="desired value"]Show this content if the field is equal to the field value I specified earlier[/gravityforms]

You can add as many conditional shortcodes as needed in your message.

Questions? Email Me

Programmatically Trigger Gravity Forms Notification

Until it makes its way to the new Gravity Forms API, you can programmatically send a specific Gravity Forms notification using the GFCommon::send_notification function which receives the notification ID, the form object, and the lead object.

If you need to send multiple notifications, you can use GFCommon::send_notifications which receives an array of IDs.

Here’s how I use send all of the notifications for a specific event that occurs:

function send_notification ( $event, $form, $lead ) {
$notifications = GFCommon::get_notifications_to_send( $event, $form, $lead );
$notifications_to_send = array();
//running through filters that disable form submission notifications
foreach ( $notifications as $notification ) {
if ( apply_filters( "gform_disable_notification_{$form['id']}", apply_filters( 'gform_disable_notification', false, $notification, $form, $lead ), $notification, $form, $lead ) ) {
//skip notifications if it has been disabled by a hook
$notifications_to_send[] = $notification['id'];
GFCommon::send_notifications( $notifications_to_send, $form, $lead, true, $event );

Questions? Email Me