The goal of this reference is to give you a general idea of the order in which Gravity Forms’ hooks are called in several typical scenarios. Click on the “More Info” link that appears when you hover over a hook to reveal additional details about the hook and it’s purpose. Many hooks also contain a “Digging Deeper” section. These sections offer helpful advice and useful insights into how Gravity Forms works.
Toggle the filters and actions off to see the top-level flow of a Gravity Forms scenario.
- Hooks Run for Initial Form Load
- Hooks Run on Form Submission with Validation Error
- Hooks Run on Successful Form Submission
Hooks Run for Initial Form Load
toggle:
Filters |
Action
Enqueue Scripts more info
It all begins with WordPress' wp_enqueue_scripts action.
This action triggers Gravity Forms' GFFormDisplay::enqueue_scripts() function. In this function, Gravity Forms determines if it needs to load any form scripts. To determine this, Gravity Forms will call the GFFormDisplay::get_embedded_forms() function. This function will search the content of all queried posts for the currrent page for the Gravity Forms shortcode (i.e. [gravityforms id="1" /]).
- gform_form_post_get_meta | filter more info
Use this filter to modify the form meta at the earliest possible point in the Gravity Forms form loading process. This filter will be applied once per form per page load as the form meta is cached until the next page load.
Digging Deeper
Gravity Forms has found a form that will be displayed on this page. It fetches the form meta (the data that controls all of the form's options) via the GFFormsModel::get_form_meta() method (note: you should use GFAPI::get_form() to get the form meta). This filter is applied within the get_form_meta() method after the meta has been retrieved.
called by GFFormsModel::get_form_meta() in forms_model.php
- gform_form_post_get_meta_{form_id} | filter more info
Form-specific version of the gform_form_post_get_meta filter. Example: gform_form_post_get_meta_1
Use this filter to modify the form meta at the earliest possible point in the Gravity Forms form loading process. This filter will be applied once per form per page load as the form meta is cached until the next page load.
Digging Deeper
Gravity Forms has found a form that will be displayed on this page. It fetches the form meta (the data that controls all of the form's options) via the GFFormsModel::get_form_meta() method (note: you should use GFAPI::get_form() to get the form meta). This filter is applied within the get_form_meta() method after the meta has been retrieved.
called by GFFormsModel::get_form_meta() in forms_model.php
- gform_pre_enqueue_scripts | action more info
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms has retrieved the form meta and and is now ready to enqueue the neccesary scripts for the forms that have been found. GFFormDisplay::enqueue_form_scripts() will enqueue all form scripts (and styles) required by the current form. The enqueue_form_scripts() method will trigger the "gform_pre_enqueue_scripts" action before the Gravity Forms scripts have been enqueued.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_pre_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_pre_enqueue_scripts action. Example: gform_pre_enqueue_scripts_1
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms has retrieved the form meta and and is now ready to enqueue the neccesary scripts for the forms that have been found. GFFormDisplay::enqueue_form_scripts() will enqueue all form scripts (and styles) required by the current form. The enqueue_form_scripts() method will trigger the "gform_pre_enqueue_scripts" action before the Gravity Forms scripts have been enqueued.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
Digging Deeper
The GFFormDisplay::enqueue_form_scripts() method calls the GFFormDisplay::has_conditional_logic() method to determine whether or not to load Gravity Forms' conditional logic script (conditional_logic.js). The has_conditional_logic() method applys the "gform_has_conditional_logic" filter to allow overriding this check.
This is most commonly used to enable conditional logic on forms with custom-coded conditional logic support rather than disabling conditional logic on forms that are using Gravity Forms' default conditional logic.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
Digging Deeper
The GFFormDisplay::has_conditional_logic() method is called a second time in the GFFormDisplay::enqueue_form_scripts() method to determine whether or not the "common" Gravity Forms script file should be loaded (gravityforms.js). This file should always be loaded if conditional logic is enabled.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_enqueue_scripts | action more info
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
Digging Deeper
All form scripts for the current form have now been enqueued.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
- gform_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_enqueue_scripts action. Example: gform_enqueue_scripts_1
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
Digging Deeper
All form scripts for the current form have now been enqueued.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
Form Markup more info
The post content is about to be displayed and Gravity Forms' shortcode is being parsed. The GFFormDisplay::get_form() method has been called to fetch the complete form markup that will then be output to the page. All of the hooks called in this section originate from the get_form() method.
- gform_form_args | filter more info
Use this filter to override the default arguments that will be used to render the form (i.e. "id", "display_title", "display_description", "ajax", "tabindex", etc). These arguments are specified in the shortcode or via the gravity_form() function.
Digging Deeper
The get_form() method applys this filter immediately allowing you to override form display argument before any form markup has been generated.
This would allow you to do things like enable AJAX for all forms or dynamically populate the form via the "field_values" argument.
called by GFFormDisplay::get_form() in form_display.php
- gform_disable_view_counter | filter more info
Use this filter to prevent the current form load from counting as a form view.
Digging Deeper
This is useful in cases where you may be fetching the form markup via the GFFormDisplay::get_form() method (outside of the normal Gravity Forms form load flow) but not displaying it.
called by GFFormDisplay::get_form() in form_display.php
- gform_disable_view_counter_{form_id} | filter more info
Form-specific version of the gform_disable_view_counter filter. Example: gform_disable_view_counter_1
Use this filter to prevent the current form load from counting as a form view.
Digging Deeper
This is useful in cases where you may be fetching the form markup via the GFFormDisplay::get_form() method (outside of the normal Gravity Forms form load flow) but not displaying it.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_render | filter more info
Use this filter to modify the $form object before the form markup is generated.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_render_{form_id} | filter more info
Form-specific version of the gform_pre_render filter. Example: gform_pre_render_1
Use this filter to modify the $form object before the form markup is generated.
called by GFFormDisplay::get_form() in form_display.php
- gform_tabindex | filter more info
Use this filter to modify the tabindex start value (default is 0) or to disable the tabindex attribute.
Digging Deeper
For a helpful snippet on resolving most tabindex issues, see this.
called by GFFormDisplay::get_form() in form_display.php
- gform_tabindex_{form_id} | filter more info
Form-specific version of the gform_tabindex filter. Example: gform_tabindex_1
Use this filter to modify the tabindex start value (default is 0) or to disable the tabindex attribute.
Digging Deeper
For a helpful snippet on resolving most tabindex issues, see this.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_enqueue_scripts | action more info
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms makes a second call to the GFFormDisplay::enqueue_form_scripts() method so that Gravity Forms scripts/styles are properly enqueued when the form is being loaded via the gravity_form() function call, rather than the shortcode.
If you're loading your form via the shortcode, you can ignore this. It won't cause you any issues.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_pre_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_pre_enqueue_scripts action. Example: gform_pre_enqueue_scripts_1
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms makes a second call to the GFFormDisplay::enqueue_form_scripts() method so that Gravity Forms scripts/styles are properly enqueued when the form is being loaded via the gravity_form() function call, rather than the shortcode.
If you're loading your form via the shortcode, you can ignore this. It won't cause you any issues.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_enqueue_scripts | action more info
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
- gform_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_enqueue_scripts action. Example: gform_enqueue_scripts_1
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
- gform_is_form_editor | filter more info
Use this filter to override the GFCommon::is_form_editor() check.
Digging Deeper
Forms are displayed differently depending on the location in which they are loaded.
This filter is applied by the GFCommon::is_form_editor() method. The GFFormDisplay::get_form() method calls the is_form_editor() method to determine if the form is being loaded in the form editor. By default, this will return false if loading the form on the frontend.
called by GFCommon::is_form_editor() in common.php
- gform_is_entry_detail | filter more info
Use this filter to override the GFCommon::is_entry_detail() check.
Digging Deeper
Forms are displayed differently depending on the location in which they are loaded.
This filter is applied by the GFCommon::is_entry_detail() method. The GFFormDisplay::get_form() method calls the is_entry_detail() method to determine if the form is being loaded in the entry detail view. By default, this will return false if loading the form on the frontend.
called by GFCommon::is_entry_detail() in common.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
Digging Deeper
This filter is called by the GFFormDisplay::has_conditional_logic() method. The GFFormDisplay::get_form() method calls the has_conditional_logic() method to determine if the form is any conditional logic enabled. If so, the form will be hidden by default. This prevents an awkward first-load experience where fields are shown/hidden depending on the conditional logic rules. After the conditional logic has been applied, Gravity Forms will automatically reveal the form.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_confirmation_anchor | filter more info
Use this filter to enable or disable the confirmation anchor functionality.
Digging Deeper
When enabled, Gravity Forms will automatically scroll the page to the confirmation message upon submission. Provide a numeric value (in pixels) to force the page to scroll to a specified distance from the top of the page. This is useful when embedding forms in a long page.
called by GFFormDisplay::get_form() in form_display.php
- gform_confirmation_anchor_{form_id} | filter more info
Form-specific version of the gform_confirmation_anchor filter. Example: gform_confirmation_anchor_1
Use this filter to enable or disable the confirmation anchor functionality.
Digging Deeper
When enabled, Gravity Forms will automatically scroll the page to the confirmation message upon submission. Provide a numeric value (in pixels) to force the page to scroll to a specified distance from the top of the page. This is useful when embedding forms in a long page.
called by GFFormDisplay::get_form() in form_display.php
- gform_form_tag | filter more info
Use this filter to modify the markup of the <form> HTML tag.
called by GFFormDisplay::get_form() in form_display.php
- gform_form_tag_{form_id} | filter more info
Form-specific version of the gform_form_tag filter. Example: gform_form_tag_1
Use this filter to modify the markup of the <form> HTML tag.
called by GFFormDisplay::get_form() in form_display.php
Field Markup Loop more info
Gravity Forms is still generating the form markup in the GFFormDisplay::get_form() method. Gravity Forms is now looping through each field on the form and generating the field markup. The following filters will be called for each field.
- gform_is_form_editor | filter more info
Use this filter to override the GFCommon::is_form_editor() check.
Digging Deeper
Fields are displayed differently in the form editor than on the frontend. Gravity Forms needs to know where we are displaying the field. If the form is being loaded on the frontend, this filter will be return false by default.
Note: this filter is called repeatedly throughout the field markup loop. The remaining calls are not listed here.
called by GFCommon::is_form_editor() in common.php
- gform_is_entry_detail | filter more info
Use this filter to override the GFCommon::is_entry_detail() check.
Digging Deeper
Fields are displayed differently in the entry detail than on the frontend. Gravity Forms needs to know where we are displaying the field. If the form is being loaded on the frontend, this filter will be return false by default.
Note: this filter is called repeatedly throughout the field markup loop. The remaining calls are not listed here.
called by GFCommon::is_entry_detail() in common.php
- gform_field_css_class | filter more info
Use this filter to add or remove CSS classes for the current field.
called by GFFormDisplay::get_field() in form_display.php
- gform_field_css_class_{form_id} | filter more info
Form-specific version of the gform_field_css_class filter. Example: gform_field_css_class_1
Use this filter to add or remove CSS classes for the current field.
called by GFFormDisplay::get_field() in form_display.php
- gform_duplicate_field_link | filter more info
Digging Deeper
Ignore. This filter is used when viewing the form in the form editor and probably should not be applied when the form is loaded on the frontend.
called by in
- gform_delete_field_link | filter more info
Digging Deeper
Ignore. This filter is used when viewing the form in the form editor and probably should not be applied when the form is loaded on the frontend.
called by in
- gform_replace_merge_tags | filter more info
Use this filter to replace custom merge tags.
Digging Deeper
This instance of the filter is replacing merge tags populated into the Default Value setting of the current field.
called by GFCommon::replace_variables_prepopulate() in common.php
- gform_field_input | filter more info
Use this filter to generate custom markup for the current field's input(s).
Digging Deeper
At the time this filter is called, the input markup has not yet been generated. This filter passes an empty string. If you return anything other than an empty string, it will be used instead of the default input markup.
called by GFCommon::get_field_input() in common.php
- gform_replace_merge_tags | filter more info
Use this filter to replace custom merge tags.
Digging Deeper
This instance of the filter is replacing merge tags populated into the Placeholder setting of the current input of the current field.
called by GFCommon::replace_variables() in common.php
- gform_field_content | filter more info
Use this filter to modify the label and input markup of the current field.
Digging Deeper
If the field has multiple inputs, all labels and inputs will be present. This filter differs from the gform_field_input filter in that it passes the default markup which can be modified and returned.
called by GFFormDisplay::get_field_content() in form_display.php
- gform_field_container | filter more info
Use this filter to modify the complete markup of the current field. This includes the <li> container that wraps each field.
called by GFFormDisplay::get_field() in form_display.php
- gform_field_container_{form_id} | filter more info
Form-specific version of the gform_field_container filter. Example: gform_field_container_1
Use this filter to modify the complete markup of the current field. This includes the <li> container that wraps each field.
called by GFFormDisplay::get_field() in form_display.php
- gform_field_container_{form_id}_{field_id} | filter more info
Field-specific version of the gform_field_container filter. Example: gform_field_container_1_2
Use this filter to modify the complete markup of the current field. This includes the <li> container that wraps each field.
called by GFFormDisplay::get_field() in form_display.php
- gform_submit_button | filter more info
Use this filter to modify the current form's submit button.
Digging Deeper
This filter is commonly used to convert the submit button from an <input type="submit" /> to an actual <button>. This allows the use of HTML inside the button for general fanciness.
called by GFFormDisplay::gform_footer() in form_display.php
- gform_submit_button_{form_id} | filter more info
Form-specific version of the gform_submit_button filter. Example: gform_submit_button_1
Use this filter to modify the current form's submit button.
Digging Deeper
This filter is commonly used to convert the submit button from an <input type="submit" /> to an actual <button>. This allows the use of HTML inside the button for general fanciness.
called by GFFormDisplay::gform_footer() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
Digging Deeper
This specific check is to determine whether or not the conditional logic initialization script should be loaded.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_register_init_scripts | action more info
Use this action to register your own init scripts.
Digging Deeper
Init scripts are inline JS scripts that are output along with the form markup and trigger the necessary JS functionality when the form is fully loaded.
called by GFFormDisplay::register_form_init_scripts() in form_display.php
- gform_register_init_scripts_{form_id} | action more info
Form-specific version of the gform_register_init_scripts action. Example: gform_register_init_scripts_1
Use this action to register your own init scripts.
Digging Deeper
Init scripts are inline JS scripts that are output along with the form markup and trigger the necessary JS functionality when the form is fully loaded.
called by GFFormDisplay::register_form_init_scripts() in form_display.php
- gform_init_scripts_footer | filter more info
Use this filter to output Gravity Forms' init scripts in the footer rather than along with the form markup.
Digging Deeper
This is useful when a script file required by an init script is ouput in the footer rather than the header. For example, if you wanted to load jQuery in the footer, you would need to set this to true so that the init scripts (which depend on jQuery) would load after jQuery has been loaded.
called by GFFormDisplay::get_form() in form_display.php
- gform_cdata_open | filter more info
Use this filter to wrap Gravity Forms' inline scripts in CDATA tags.
Digging Deeper
This is required for valid XHTML. Most themes use HTML5 now which does not require CDATA tags for validation.
called by GFFormDisplay::get_form() in form_display.php
- gform_cdata_close | filter more info
Use this filter to wrap Gravity Forms' inline scripts in CDATA tags.
Digging Deeper
This is required for valid XHTML. Most themes use HTML5 now which does not require CDATA tags for validation.
called by GFFormDisplay::get_form() in form_display.php
- gform_get_form_filter | filter more info
Use this filter to modify the complete form markup.
Digging Deeper
The form markup is passed as a string and expects a string response. This filter is commonly used to hide the form if a specific condition is not met.
called by GFFormDisplay::get_form() in form_display.php
- gform_get_form_filter_{form_id} | filter more info
Form-specific version of the gform_get_form_filter filter. Example: gform_get_form_filter_1
Use this filter to modify the complete form markup.
Digging Deeper
The form markup is passed as a string and expects a string response. This filter is commonly used to hide the form if a specific condition is not met.
called by GFFormDisplay::get_form() in form_display.php
- gform_shortcode_form | filter more info
Use this filter to modify the complete form markup.
Digging Deeper
This provides the same functionality as the gform_get_form_filter filter but is only applied when the form is loaded via the shortcode. For global modification of the generated form markup, use the gform_get_form_filter filter.
called by GFForms::parse_shortcode() in gravityforms.php
Hooks Run on Form Submission with Validation Error
toggle:
Filters |
Action
Form Submission Processing more info
The form submission process begins with WordPress' wp action. This action is triggered once WordPress is fully loaded and the WP object is setup (a.k.a. WordPress is ready to rock n' roll).
Gravity Forms binds the GFForms::maybe_process_form() method to the wp action. This method checks the submitted data to confirm that the submission is from a Gravity Forms form. If so, Gravity Forms will call the GFFormDisplay::process_form() method to begin processing the form submission.
- gform_form_post_get_meta | filter more info
Use this filter to modify the form meta at the earliest possible point in the Gravity Forms form loading process. This filter will be applied once per form per page load as the form meta is cached until the next page load.
Digging Deeper
Note that this filter fires earlier on a form submission than on the intial form load. Typically this won't cause any issues but it is something to be aware of.
called by GFForms::maybe_process_form() in gravityforms.php
- gform_form_post_get_meta_{form_id} | filter more info
Form-specific version of the gform_form_post_get_meta filter. Example: gform_form_post_get_meta_1
Use this filter to modify the form meta at the earliest possible point in the Gravity Forms form loading process. This filter will be applied once per form per page load as the form meta is cached until the next page load.
Digging Deeper
Note that this filter fires earlier on a form submission than on the intial form load. Typically this won't cause any issues but it is something to be aware of.
called by GFFormsModel::get_form_meta() in forms_model.php
- gform_pre_process | action more info
Use this action to execute custom code prior to form submission being processed.
Digging Deeper
Gravity Forms has now processed some additional validation on the $form object to ensure that it should continue processing this submission. The form is not in the trash, the form is active and if the form requires a logged in user, this requirement is confirmed.
called by GFFormsDisplay::process_form() in form_display.php
- gform_pre_process_{form_id} | action more info
Form-specific version of the gform_pre_process action. Example: gform_pre_process_1
Use this action to execute custom code prior to form submission being processed.
Digging Deeper
Gravity Forms has now processed some additional validation on the $form object to ensure that it should continue processing this submission. The form is not in the trash, the form is active and if the form requires a logged in user, this requirement is confirmed.
called by GFFormsDisplay::process_form() in form_display.php
Form Validation more info
Gravity Forms is ready to validate the submitted data based on the current $form object.
- gform_pre_validation | filter more info
Use this filter to modify the $form object prior to Gravity Forms' default validation.
called by GFFormDisplay::validate() in form_display.php
- gform_pre_validation_{form_id} | filter more info
Form-specific version of the gform_pre_validation filter. Example: gform_pre_validation_1
Use this filter to modify the $form object prior to Gravity Forms' default validation.
called by GFFormDisplay::validate() in form_display.php
Field Validation Loop more info
Gravity Forms is validating the submitted value for each field in the current form. The following hooks will be called for each field unless the field is hidden via conditional logic or is an Admin Only field.
- gform_trim_input_value | filter more info
Use this filter to disable the removal of blank spaces at the beginning and end of field values. By default, all trailing and leading spaces will be removed.
called by GFFormsModel::maybe_trim_input() in forms_model.php
- gform_field_validation | filter more info
Use this filter to override the validation per field. Gravity Forms will handle marking the submission as invalid if you return a validation error on any field.
called by GFFormDisplay::validate() in form_display.php
- gform_field_validation_{form_id} | filter more info
Form-specific version of the gform_field_validation filter. Example: gform_field_validation_1
Use this filter to override the validation per field. Gravity Forms will handle marking the submission as invalid if you return a validation error on any field.
called by GFFormDisplay::validate() in form_display.php
- gform_field_validation_{form_id}_{field_id} | filter more info
Field-specific version of the gform_field_validation filter. Example: gform_field_validation_1_2
Use this filter to override the validation per field. Gravity Forms will handle marking the submission as invalid if you return a validation error on any field.
called by GFFormDisplay::validate() in form_display.php
- gform_validation | filter more info
Use this filter to override the submission validation as a whole.
Digging Deeper
If you are validating many fields or need a more generic validation method, this is the preferred hook for doing so. You can override the validation for each field as well as the final submisison validation result.
called by GFFormDisplay::validate() in form_display.php
- gform_validation_{form_id} | filter more info
Form-specific version of the gform_validation filter. Example: gform_validation_1
Use this filter to override the submission validation as a whole.
Digging Deeper
If you are validating many fields or need a more generic validation method, this is the preferred hook for doing so. You can override the validation for each field as well as the final submisison validation result.
called by GFFormDisplay::validate() in form_display.php
- gform_post_process | action more info
Use this action to excecute code after the form submission has been processed.
called by GFFormDisplay::process_form() in form_display.php
- gform_post_process_{form_id} | action more info
Form-specific version of the gform_post_process action. Example: gform_post_process_1
Use this action to excecute code after the form submission has been processed.
called by GFFormDisplay::process_form() in form_display.php
Enqueue Scripts more info
Not much changes when enqueueing scripts for a form with a validation error. The enqueuing process still kicks off with WordPress' wp_enqueue_scripts action.
This action triggers Gravity Forms' GFFormDisplay::enqueue_scripts() function. In this function, Gravity Forms determines if it needs to load any form scripts. To determine this, Gravity Forms will call the GFFormDisplay::get_embedded_forms() function. This function will search the content of all queried posts for the currrent page for the Gravity Forms shortcode (i.e. [gravityforms id="1" /]).
- gform_pre_enqueue_scripts | action more info
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms has retrieved the form meta and and is now ready to enqueue the neccesary scripts for the forms that have been found. GFFormDisplay::enqueue_form_scripts() will enqueue all form scripts (and styles) required by the current form. The enqueue_form_scripts() method will trigger the "gform_pre_enqueue_scripts" action before the Gravity Forms scripts have been enqueued.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_pre_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_pre_enqueue_scripts action. Example: gform_pre_enqueue_scripts_1
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms has retrieved the form meta and and is now ready to enqueue the neccesary scripts for the forms that have been found. GFFormDisplay::enqueue_form_scripts() will enqueue all form scripts (and styles) required by the current form. The enqueue_form_scripts() method will trigger the "gform_pre_enqueue_scripts" action before the Gravity Forms scripts have been enqueued.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
Digging Deeper
The GFFormDisplay::enqueue_form_scripts() method calls the GFFormDisplay::has_conditional_logic() method to determine whether or not to load Gravity Forms' conditional logic script (conditional_logic.js). The has_conditional_logic() method applys the "gform_has_conditional_logic" filter to allow overriding this check.
This is most commonly used to enable conditional logic on forms with custom-coded conditional logic support rather than disabling conditional logic on forms that are using Gravity Forms' default conditional logic.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
Digging Deeper
The GFFormDisplay::enqueue_form_scripts() method calls the GFFormDisplay::has_conditional_logic() method to determine whether or not to load Gravity Forms' conditional logic script (conditional_logic.js). The has_conditional_logic() method applys the "gform_has_conditional_logic" filter to allow overriding this check.
This is most commonly used to enable conditional logic on forms with custom-coded conditional logic support rather than disabling conditional logic on forms that are using Gravity Forms' default conditional logic.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_enqueue_scripts | action more info
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
Digging Deeper
All form scripts for the current form have now been enqueued.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
- gform_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_enqueue_scripts action. Example: gform_enqueue_scripts_1
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
Digging Deeper
All form scripts for the current form have now been enqueued.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
Form Markup more info
The post content is about to be displayed and Gravity Forms' shortcode is being parsed. The GFFormDisplay::get_form() method has been called to fetch the complete form markup that will then be output to the page. All of the hooks called in this section originate from the get_form() method.
- gform_form_args | filter more info
Use this filter to override the default arguments that will be used to render the form (i.e. "id", "display_title", "display_description", "ajax", "tabindex", etc). These arguments are specified in the shortcode or via the gravity_form() function.
Digging Deeper
The get_form() method applys this filter immediately allowing you to override form display argument before any form markup has been generated.
This would allow you to do things like enable AJAX for all forms or dynamically populate the form via the "field_values" argument.
called by GFFormDisplay::get_form() in form_display.php
- gform_disable_view_counter | filter more info
Use this filter to prevent the current form load from counting as a form view.
Digging Deeper
This is useful in cases where you may be fetching the form markup via the GFFormDisplay::get_form() method (outside of the normal Gravity Forms form load flow) but not displaying it.
called by GFFormDisplay::get_form() in form_display.php
- gform_disable_view_counter_{form_id} | filter more info
Form-specific version of the gform_disable_view_counter filter. Example: gform_disable_view_counter_1
Use this filter to prevent the current form load from counting as a form view.
Digging Deeper
This is useful in cases where you may be fetching the form markup via the GFFormDisplay::get_form() method (outside of the normal Gravity Forms form load flow) but not displaying it.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_render | filter more info
Use this filter to modify the $form object before the form markup is generated.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_render_{form_id} | filter more info
Form-specific version of the gform_pre_render filter. Example: gform_pre_render_1
Use this filter to modify the $form object before the form markup is generated.
called by GFFormDisplay::get_form() in form_display.php
- gform_tabindex | filter more info
Use this filter to modify the tabindex start value (default is 0) or to disable the tabindex attribute.
Digging Deeper
For a helpful snippet on resolving most tabindex issues, see this.
called by GFFormDisplay::get_form() in form_display.php
- gform_tabindex_{form_id} | filter more info
Form-specific version of the gform_tabindex filter. Example: gform_tabindex_1
Use this filter to modify the tabindex start value (default is 0) or to disable the tabindex attribute.
Digging Deeper
For a helpful snippet on resolving most tabindex issues, see this.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_enqueue_scripts | action more info
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms makes a second call to the GFFormDisplay::enqueue_form_scripts() method so that Gravity Forms scripts/styles are properly enqueued when the form is being loaded via the gravity_form() function call, rather than the shortcode.
If you're loading your form via the shortcode, you can ignore this. It won't cause you any issues.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_pre_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_pre_enqueue_scripts action. Example: gform_pre_enqueue_scripts_1
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms makes a second call to the GFFormDisplay::enqueue_form_scripts() method so that Gravity Forms scripts/styles are properly enqueued when the form is being loaded via the gravity_form() function call, rather than the shortcode.
If you're loading your form via the shortcode, you can ignore this. It won't cause you any issues.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_enqueue_scripts | action more info
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
- gform_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_enqueue_scripts action. Example: gform_enqueue_scripts_1
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
- gform_is_form_editor | filter more info
Use this filter to override the GFCommon::is_form_editor() check.
Digging Deeper
Forms are displayed differently depending on the location in which they are loaded.
This filter is applied by the GFCommon::is_form_editor() method. The GFFormDisplay::get_form() method calls the is_form_editor() method to determine if the form is being loaded in the form editor. By default, this will return false if loading the form on the frontend.
called by GFCommon::is_form_editor() in common.php
- gform_is_entry_detail | filter more info
Use this filter to override the GFCommon::is_entry_detail() check.
Digging Deeper
Forms are displayed differently depending on the location in which they are loaded.
This filter is applied by the GFCommon::is_entry_detail() method. The GFFormDisplay::get_form() method calls the is_entry_detail() method to determine if the form is being loaded in the entry detail view. By default, this will return false if loading the form on the frontend.
called by GFCommon::is_entry_detail() in common.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_confirmation_anchor | filter more info
Use this filter to enable or disable the confirmation anchor functionality.
Digging Deeper
When enabled, Gravity Forms will automatically scroll the page to the confirmation message upon submission. Provide a numeric value (in pixels) to force the page to scroll to a specified distance from the top of the page. This is useful when embedding forms in a long page.
called by GFFormDisplay::get_form() in form_display.php
- gform_confirmation_anchor_{form_id} | filter more info
Form-specific version of the gform_confirmation_anchor filter. Example: gform_confirmation_anchor_1
Use this filter to enable or disable the confirmation anchor functionality.
Digging Deeper
When enabled, Gravity Forms will automatically scroll the page to the confirmation message upon submission. Provide a numeric value (in pixels) to force the page to scroll to a specified distance from the top of the page. This is useful when embedding forms in a long page.
called by GFFormDisplay::get_form() in form_display.php
- gform_form_tag | filter more info
Use this filter to modify the markup of the <form> HTML tag.
called by GFFormDisplay::get_form() in form_display.php
- gform_form_tag_{form_id} | filter more info
Form-specific version of the gform_form_tag filter. Example: gform_form_tag_1
Use this filter to modify the markup of the <form> HTML tag.
called by GFFormDisplay::get_form() in form_display.php
- gform_validation_message | filter more info
Use this filter to modify the validation message that displays at the top of the form. By default, this validation message does not list specific validation errors but indicates that there are errors on the form.
called by GFFormDisplay::get_form() in form_display.php
- gform_validation_message_{form_id} | filter more info
Form-specific version of the gform_validation_message filter. Example: gform_validation_message_1
Use this filter to modify the validation message that displays at the top of the form. By default, this validation message does not list specific validation errors but indicates that there are errors on the form.
called by GFFormDisplay::get_form() in form_display.php
- gform_trim_input_value | filter more info
Use this filter to disable the removal of blank spaces at the beginning and end of field values. By default, all trailing and leading spaces will be removed.
Digging Deeper
Since the form has been submitted, Gravity Forms will repopulate submitted values back into their respective fields. The submitted field value is retrieved via the GFFormsModel::get_field_value() method. This starts a chain that will eventually call the GFFormsModel::maybe_trim_input_value() method which applies this filter.
called by GFFormsModel::maybe_trim_input() in forms_model.php
- gform_is_form_editor | filter more info
Use this filter to override the GFCommon::is_form_editor() check.
Digging Deeper
Fields are displayed differently in the form editor than on the frontend. Gravity Forms needs to know where we are displaying the field. If the form is being loaded on the frontend, this filter will be return false by default.
Note: this filter is called repeatedly throughout the field markup loop. The remaining calls are not listed here.
called by GFCommon::is_form_editor() in common.php
- gform_is_entry_detail | filter more info
Use this filter to override the GFCommon::is_entry_detail() check.
Digging Deeper
Fields are displayed differently in the entry detail than on the frontend. Gravity Forms needs to know where we are displaying the field. If the form is being loaded on the frontend, this filter will be return false by default.
Note: this filter is called repeatedly throughout the field markup loop. The remaining calls are not listed here.
called by GFCommon::is_entry_detail() in common.php
- gform_field_css_class | filter more info
Use this filter to add or remove CSS classes for the current field.
called by GFFormDisplay::get_field() in form_display.php
- gform_field_css_class_{form_id} | filter more info
Form-specific version of the gform_field_css_class filter. Example: gform_field_css_class_1
Use this filter to add or remove CSS classes for the current field.
called by GFFormDisplay::get_field() in form_display.php
- gform_duplicate_field_link | filter more info
Digging Deeper
Ignore. This filter is used when viewing the form in the form editor and probably should not be applied when the form is loaded on the frontend.
called by in
- gform_delete_field_link | filter more info
Digging Deeper
Ignore. This filter is used when viewing the form in the form editor and probably should not be applied when the form is loaded on the frontend.
called by in
- gform_replace_merge_tags | filter more info
Use this filter to replace custom merge tags.
Digging Deeper
This instance of the filter is replacing merge tags populated into the Default Value setting of the current field.
called by GFCommon::replace_variables_prepopulate() in common.php
- gform_field_input | filter more info
Use this filter to generate custom markup for the current field's input(s).
Digging Deeper
At the time this filter is called, the input markup has not yet been generated. This filter passes an empty string. If you return anything other than an empty string, it will be used instead of the default input markup.
called by GFCommon::get_field_input() in common.php
- gform_replace_merge_tags | filter more info
Use this filter to replace custom merge tags.
Digging Deeper
This instance of the filter is replacing merge tags populated into the Placeholder setting of the current input of the current field.
called by GFCommon::replace_variables() in common.php
- gform_field_content | filter more info
Use this filter to modify the label and input markup of the current field.
Digging Deeper
If the field has multiple inputs, all labels and inputs will be present. This filter differs from the gform_field_input filter in that it passes the default markup which can be modified and returned.
called by GFFormDisplay::get_field_content() in form_display.php
- gform_field_container | filter more info
Use this filter to modify the complete markup of the current field. This includes the <li> container that wraps each field.
called by GFFormDisplay::get_field() in form_display.php
- gform_field_container_{form_id} | filter more info
Form-specific version of the gform_field_container filter. Example: gform_field_container_1
Use this filter to modify the complete markup of the current field. This includes the <li> container that wraps each field.
called by GFFormDisplay::get_field() in form_display.php
- gform_field_container_{form_id}_{field_id} | filter more info
Field-specific version of the gform_field_container filter. Example: gform_field_container_1_2
Use this filter to modify the complete markup of the current field. This includes the <li> container that wraps each field.
called by GFFormDisplay::get_field() in form_display.php
- gform_submit_button | filter more info
Use this filter to modify the current form's submit button.
Digging Deeper
This filter is commonly used to convert the submit button from an <input type="submit" /> to an actual <button>. This allows the use of HTML inside the button for general fanciness.
called by GFFormDisplay::gform_footer() in form_display.php
- gform_submit_button_{form_id} | filter more info
Form-specific version of the gform_submit_button filter. Example: gform_submit_button_1
Use this filter to modify the current form's submit button.
Digging Deeper
This filter is commonly used to convert the submit button from an <input type="submit" /> to an actual <button>. This allows the use of HTML inside the button for general fanciness.
called by GFFormDisplay::gform_footer() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
Digging Deeper
This specific check is to determine whether or not the conditional logic initialization script should be loaded.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_register_init_scripts | action more info
Use this action to register your own init scripts.
Digging Deeper
Init scripts are inline JS scripts that are output along with the form markup and trigger the necessary JS functionality when the form is fully loaded.
called by GFFormDisplay::register_form_init_scripts() in form_display.php
- gform_register_init_scripts_{form_id} | action more info
Form-specific version of the gform_register_init_scripts action. Example: gform_register_init_scripts_1
Use this action to register your own init scripts.
Digging Deeper
Init scripts are inline JS scripts that are output along with the form markup and trigger the necessary JS functionality when the form is fully loaded.
called by GFFormDisplay::register_form_init_scripts() in form_display.php
- gform_init_scripts_footer | filter more info
Use this filter to output Gravity Forms' init scripts in the footer rather than along with the form markup.
Digging Deeper
This is useful when a script file required by an init script is ouput in the footer rather than the header. For example, if you wanted to load jQuery in the footer, you would need to set this to true so that the init scripts (which depend on jQuery) would load after jQuery has been loaded.
called by GFFormDisplay::get_form() in form_display.php
- gform_cdata_open | filter more info
Use this filter to wrap Gravity Forms' inline scripts in CDATA tags.
Digging Deeper
This is required for valid XHTML. Most themes use HTML5 now which does not require CDATA tags for validation.
called by GFFormDisplay::get_form() in form_display.php
- gform_cdata_close | filter more info
Use this filter to wrap Gravity Forms' inline scripts in CDATA tags.
Digging Deeper
This is required for valid XHTML. Most themes use HTML5 now which does not require CDATA tags for validation.
called by GFFormDisplay::get_form() in form_display.php
- gform_get_form_filter | filter more info
Use this filter to modify the complete form markup.
Digging Deeper
The form markup is passed as a string and expects a string response. This filter is commonly used to hide the form if a specific condition is not met.
called by GFFormDisplay::get_form() in form_display.php
- gform_get_form_filter_{form_id} | filter more info
Form-specific version of the gform_get_form_filter filter. Example: gform_get_form_filter_1
Use this filter to modify the complete form markup.
Digging Deeper
The form markup is passed as a string and expects a string response. This filter is commonly used to hide the form if a specific condition is not met.
called by GFFormDisplay::get_form() in form_display.php
- gform_shortcode_form | filter more info
Use this filter to modify the complete form markup.
Digging Deeper
This provides the same functionality as the gform_get_form_filter filter but is only applied when the form is loaded via the shortcode. For global modification of the generated form markup, use the gform_get_form_filter filter.
called by GFForms::parse_shortcode() in gravityforms.php
Hooks Run on Successful Form Submission
This scenario uses the default confirmation and the default notification.
toggle:
Filters |
Action
Form Submission Processing more info
The form submission process begins with WordPress' wp action. This action is triggered once WordPress is fully loaded and the WP object is setup (a.k.a. WordPress is ready to rock n' roll).
Gravity Forms binds the GFForms::maybe_process_form() method to the wp action. This method checks the submitted data to confirm that the submission is from a Gravity Forms form. If so, Gravity Forms will call the GFFormDisplay::process_form() method to begin processing the form submission.
- gform_form_post_get_meta | filter more info
Use this filter to modify the form meta at the earliest possible point in the Gravity Forms form loading process. This filter will be applied once per form per page load as the form meta is cached until the next page load.
Digging Deeper
Note that this filter fires earlier on a form submission than on the intial form load. Typically this won't cause any issues but it is something to be aware of.
called by GFFormsModel::get_form_meta() in forms_model.php
- gform_form_post_get_meta_{form_id} | filter more info
Form-specific version of the gform_form_post_get_meta filter. Example: gform_form_post_get_meta_1
Use this filter to modify the form meta at the earliest possible point in the Gravity Forms form loading process. This filter will be applied once per form per page load as the form meta is cached until the next page load.
Digging Deeper
Note that this filter fires earlier on a form submission than on the intial form load. Typically this won't cause any issues but it is something to be aware of.
called by GFFormsModel::get_form_meta() in forms_model.php
- gform_pre_process | action more info
Use this action to execute custom code prior to form submission being processed.
Digging Deeper
Gravity Forms has now processed some additional validation on the $form object to ensure that it should continue processing this submission. The form is not in the trash, the form is active and if the form requires a logged in user, this requirement is confirmed.
called by GFFormsDisplay::process_form() in form_display.php
- gform_pre_process_{form_id} | action more info
Form-specific version of the gform_pre_process action. Example: gform_pre_process_1
Use this action to execute custom code prior to form submission being processed.
Digging Deeper
Gravity Forms has now processed some additional validation on the $form object to ensure that it should continue processing this submission. The form is not in the trash, the form is active and if the form requires a logged in user, this requirement is confirmed.
called by GFFormsDisplay::process_form() in form_display.php
Form Validation more info
Gravity Forms is ready to validate the submitted data based on the current $form object.
- gform_pre_validation | filter more info
Use this filter to modify the $form object prior to Gravity Forms' default validation.
called by GFFormDisplay::validate() in form_display.php
- gform_pre_validation_{form_id} | filter more info
Form-specific version of the gform_pre_validation filter. Example: gform_pre_validation_1
Use this filter to modify the $form object prior to Gravity Forms' default validation.
called by GFFormDisplay::validate() in form_display.php
Field Validation Loop more info
Gravity Forms is validating the submitted value for each field in the current form. The following hooks will be called for each field unless the field is hidden via conditional logic or is an Admin Only field.
- gform_trim_input_value | filter more info
Use this filter to disable the removal of blank spaces at the beginning and end of field values. By default, all trailing and leading spaces will be removed.
called by GFFormsModel::maybe_trim_input() in forms_model.php
- gform_field_validation | filter more info
Use this filter to override the validation per field. Gravity Forms will handle marking the submission as invalid if you return a validation error on any field.
called by GFFormDisplay::validate() in form_display.php
- gform_field_validation_{form_id} | filter more info
Form-specific version of the gform_field_validation filter. Example: gform_field_validation_1
Use this filter to override the validation per field. Gravity Forms will handle marking the submission as invalid if you return a validation error on any field.
called by GFFormDisplay::validate() in form_display.php
- gform_field_validation_{form_id}_{field_id} | filter more info
Field-specific version of the gform_field_validation filter. Example: gform_field_validation_1_2
Use this filter to override the validation per field. Gravity Forms will handle marking the submission as invalid if you return a validation error on any field.
called by GFFormDisplay::validate() in form_display.php
- gform_validation | filter more info
Use this filter to override the submission validation as a whole.
Digging Deeper
If you are validating many fields or need a more generic validation method, this is the preferred hook for doing so. You can override the validation for each field as well as the final submisison validation result.
called by GFFormDisplay::validate() in form_display.php
- gform_validation_{form_id} | filter more info
Form-specific version of the gform_validation filter. Example: gform_validation_1
Use this filter to override the submission validation as a whole.
Digging Deeper
If you are validating many fields or need a more generic validation method, this is the preferred hook for doing so. You can override the validation for each field as well as the final submisison validation result.
called by GFFormDisplay::validate() in form_display.php
- gform_pre_submission | action more info
Use this action to excecute code after the submission has been successfully validated and before the submission is saved as an entry in the database.
Digging Deeper
This action will only be triggered if the submission has been validated successfully. A form submission that results in a validation error is technically still a submission; however, this filter refers to valid submissions only.
called by GFFormDisplay::process_form() in form_display.php
- gform_pre_submission_{form_id} | action more info
Form-specific version of the gform_pre_submission action. Example: gform_pre_submission_1
Use this action to excecute code after the submission has been successfully validated and before the submission is saved as an entry in the database.
Digging Deeper
This action will only be triggered if the submission has been validated successfully. A form submission that results in a validation error is technically still a submission; however, this filter refers to valid submissions only.
called by GFFormDisplay::process_form() in form_display.php
- gform_pre_submission_filter | filter more info
Use this filter to modify the $form object after the submission has been successfully validated and before the submission is saved as an entry in the database.
Digging Deeper
Like the gform_pre_submission action, this filter will only be triggered when the submission has been validated successfully.
This filter is commonly use in combination with the gform_pre_render hook so that modifications made to the $form object for rendering also apply to the $form object used for submission.
called by GFFormDisplay::process_form() in form_display.php
- gform_pre_submission_filter_{form_id} | filter more info
Form-specific version of the gform_pre_submission_filter filter. Example: gform_pre_submission_filter_1
Use this filter to modify the $form object after the submission has been successfully validated and before the submission is saved as an entry in the database.
Digging Deeper
Like the gform_pre_submission action, this filter will only be triggered when the submission has been validated successfully.
This filter is commonly use in combination with the gform_pre_render hook so that modifications made to the $form object for rendering also apply to the $form object used for submission.
called by GFFormDisplay::process_form() in form_display.php
Saving Entry more info
Great news! The submission has been successfully validated. Gravity Forms is going to save the submission as an $entry object in the database.
- gform_entry_id_pre_save_lead | filter more info
Use this filter to modify the entry ID before the entry is saved.
Digging Deeper
This hook allows you to update an existing entry rather than creating a new entry. Just return the entry ID of the existing entry and the submitted values will be used to update the entry. By default, the entry ID will be null.
If an entry ID is provided, the associated $entry object will be used throughout the rest of the submission process.
called by GFFormDisplay::handle_submission() in form_display.php
- gform_entry_id_pre_save_lead_{form_id} | filter more info
Form-specific version of the gform_entry_id_pre_save_lead filter. Example: gform_entry_id_pre_save_lead_1
Use this filter to modify the entry ID before the entry is saved.
Digging Deeper
This hook allows you to update an existing entry rather than creating a new entry. Just return the entry ID of the existing entry and the submitted values will be used to update the entry. By default, the entry ID will be null.
If an entry ID is provided, the associated $entry object will be used throughout the rest of the submission process.
called by GFFormDisplay::handle_submission() in form_display.php
- gform_is_form_editor | filter more info
Use this filter to override the GFCommon::is_form_editor() check.
Digging Deeper
Gravity Forms calls the GFCommon::is_form_editor() and the GFCommon::is_entry_detail() methods to determine if the $entry is being saved from within the WordPress admin. If so, it also confirms that the user has the correct permissions to edit entries.
called by GFCommon::is_form_editor() in common.php
- gform_is_entry_detail | filter more info
Use this filter to override the GFCommon::is_entry_detail() check.
Digging Deeper
Gravity Forms calls the GFCommon::is_form_editor() and the GFCommon::is_entry_detail() methods to determine if the $entry is being saved from within the WordPress admin. If so, it also confirms that the user has the correct permissions to edit entries.
called by GFCommon::is_entry_detail() in common.php
- gform_currency | filter more info
Use this filter to change the currency. This will default to the currency configured on the Gravity Forms settings page.
called by GFCommon::get_currency() in forms_model.php
Saving Fields more info
The basic entry details have been saved to the database (e.g. "form_id", "ip", "source_url", "date_created", "user_agent", "currency", "created_by"). Gravity Forms will now loop through each field (and each input for multi-input fields) and save them individually to entry. All of these hooks are originate from the GFFormsModel::save_input() method.
- gform_trim_input_value | filter more info
Use this filter to disable the removal of blank spaces at the beginning and end of field values. By default, all trailing and leading spaces will be removed.
called by GFFormsModel::maybe_trim_input() in forms_model.php
- gform_is_form_editor | filter more info
Use this filter to override the GFCommon::is_form_editor() check.
called by GFCommon::is_form_editor() in common.php
- gform_is_entry_detail | filter more info
Use this filter to override the GFCommon::is_entry_detail() check.
called by GFCommon::is_entry_detail() in common.php
- gform_allowable_tags | filter more info
Use this filter to enable HTML or specify accepted HTML tags in submitted entry data.
Digging Deeper
Most fields will have HTML disabled by default. This filter is most often used to allow specific HTML tags in specific fields (i.e. Paragraph Text field). Be wary of enabling HTML unconditionally unless you know what you're doing.
called by GFField::sanitize_entry_value() in /includes/fields/class-gf-field.php
- gform_allowable_tags_{form_id} | filter more info
Form-specific version of the gform_allowable_tags filter. Example: gform_allowable_tags_1
Use this filter to enable HTML or specify accepted HTML tags in submitted entry data.
Digging Deeper
Most fields will have HTML disabled by default. This filter is most often used to allow specific HTML tags in specific fields (i.e. Paragraph Text field). Be wary of enabling HTML unconditionally unless you know what you're doing.
called by GFField::sanitize_entry_value() in /includes/fields/class-gf-field.php
- gform_save_field_value | filter more info
Use this filter to modify the field value before it is saved to the database.
Digging Deeper
This filter can be used in conjunction with gform_get_input_value to allow you to store the value in the database in one format but retrieve it another (i.e. encrypt/decrypt).
called by GFFormsModel::get_prepared_input_value() in forms_model.php
- gform_get_input_value | filter more info
Use this filter to modify the field value after it has been retrieved from the database.
Digging Deeper
This filter can be used in conjunction with gform_save_input_value to allow you to store the value in the database in one format but retrieve it another (i.e. encrypt/decrypt).
Note: this filter will be called for each input of each field on your form.
called by GFFormsModel::build_lead_array() in forms_model.php
- gform_entry_meta | filter more info
Use this filter to add custom properties (a.k.a "meta") to the $entry object.
Digging Deeper
Entry meta data can be added as sortable columns to the entry list and export entries file.
called by GFFormsModel::get_entry_meta() in forms_model.php
- gform_entry_is_spam | filter more info
Use this filter to modify whether the current entry is considered spam.
Digging Deeper
Gravity Forms will only mark an entry as spam if Akismet is enabled, the "Akismet Integration" setting has not been disabled, and Akismet has indicated the entry is spam. This filter will allow you to override Akismet's assessment.
This hook would also be the ideal access point to provide your own custom spam protection or integrate with another 3rd party spam protection service.
called by GFFormDisplay::handle_submission() in form_display.php
- gform_entry_is_spam_{form_id} | filter more info
Form-specific version of the gform_entry_is_spam filter. Example: gform_entry_is_spam_1
Use this filter to modify whether the current entry is considered spam.
Digging Deeper
Gravity Forms will only mark an entry as spam if Akismet is enabled, the "Akismet Integration" setting has not been disabled, and Akismet has indicated the entry is spam. This filter will allow you to override Akismet's assessment.
This hook would also be the ideal access point to provide your own custom spam protection or integrate with another 3rd party spam protection service.
called by GFFormDisplay::handle_submission() in form_display.php
- gform_entry_created | action more info
Use this action to execute code after the entry has been created.
Digging Deeper
Note: this filter is applied before the post has been created, notifications have been sent and the confirmation has been processed. If you need to modify the $entry object, use the [gform_entry_post_save]($entry object](https://www.gravityhelp.com/documentation/article/entry-object/), use the [gform_entry_post_save) filter.
called by GFFormDisplay::handle_submission() in form_display.php
- gform_entry_post_save | filter more info
Use this filter to modify the entry after it has been saved to the database.
called by GFFormDisplay::handle_submission() in form_display.php
- gform_entry_post_save_{form_id} | filter more info
Form-specific version of the gform_entry_post_save filter. Example: gform_entry_post_save_1
Use this filter to modify the entry after it has been saved to the database.
called by GFFormDisplay::handle_submission() in form_display.php
- gform_disable_post_creation | filter more info
Use this filter to disable post creation for GF.
Digging Deeper
This filter is only applicable if the form contains a Post Field. If you return true and the form does not contain a Post Field, Gravity Forms will still abandon the post creation process.
called by GFCommon::create_post() in common.php
- gform_disable_post_creation_{form_id} | filter more info
Form-specific version of the gform_disable_post_creation filter. Example: gform_disable_post_creation_1
Use this filter to disable post creation for GF.
Digging Deeper
This filter is only applicable if the form contains a Post Field. If you return true and the form does not contain a Post Field, Gravity Forms will still abandon the post creation process.
called by GFCommon::create_post() in common.php
Sending Form Notifications more info
The entry has been created and saved to the database. Now Gravity Forms is ready to send notifications.
- gform_disable_notification | filter more info
Use this filter to disable all or specific notifications.
Digging Deeper
This filter is applied for each notification to be sent. The current $notification object is passed for each filter call.
called by GFAPI::send_notifications() in /includes/api.php
- gform_disable_notification_{form_id} | filter more info
Form-specific version of the gform_disable_notification filter. Example: gform_disable_notification_1
Use this filter to disable all or specific notifications.
Digging Deeper
This filter is applied for each notification to be sent. The current $notification object is passed for each filter call.
called by GFAPI::send_notifications() in /includes/api.php
- gform_notification | filter more info
Digging Deeper
This is the go-to filter for modify notifications. It gives you complete access to the $notification object so you can make all sorts of changes and still allow Gravity Forms to handle much of the heavy lifting.
called by GFCommon::send_notification() in common.php
- gform_notification_{form_id} | filter more info
Digging Deeper
This is the go-to filter for modify notifications. It gives you complete access to the $notification object so you can make all sorts of changes and still allow Gravity Forms to handle much of the heavy lifting.
called by GFCommon::send_notification() in common.php
- gform_pre_replace_merge_tags | filter more info
Use this filter to replace default Gravity Forms merge tags before they are replaced by GF.
Digging Deeper
GFCommon::replace_variables() is being called now to process the "to", "subject", "from", "from_name", "bcc, "replyTo", and "message" notification properties. This filter is called once for each property via the GFCommon::replace_variables() method.
called by GFCommon::replace_variables() in common.php
- gform_replace_merge_tags | filter more info
Use this filter to replace custom merge tags.
Digging Deeper
GFCommon::replace_variables() is being called now to process the "to", "subject", "from", "from_name", "bcc, "replyTo", and "message" notification properties. This filter is called once for each property via the GFCommon::replace_variables_prepopulate() method.
called by GFCommon::replace_variables_prepopulate() in common.php
- gform_replace_merge_tags | filter more info
Use this filter to replace custom merge tags.
Digging Deeper
GFCommon::replace_variables() is being called now to process the "to", "subject", "from", "from_name", "bcc, "replyTo", and "message" notification properties. This filter is called once for each property via the GFCommon::replace_variables() method.
called by GFCommon::replace_variables_prepopulate() in common.php
{all_fields} more info
Since the {all_fields} merge tag is the most popular Gravity Forms merge tag, I wanted to cover its usage in notifications. At this point, Gravity Forms is processing the "message" property of the current notification. The default notification contains the {all_fields} merge tag.
Note: the gform_replace_merge_tags filter is called after the {all_fields} markup has been generated. It is excluded here for the sake of orginzation.
- gform_get_field_value | filter more info
called by GFFormsModel::get_lead_field_value() in forms_model.php
- gform_merge_tag_filter | filter more info
Use this filter to modify the output of default Gravity Forms merge tags.
Digging Deeper
This filter's purpose differs from gform_replace_merge_tags in that it allows you to modify (or completely replace) the generated value of default Gravity Forms merge tags. The addition of the gform_pre_replace_merge_tags filter allows you to now replace default Gravity Forms merge tags; however, this filter is still the preferred method for doing so. It will provide field-specific data based on the merge tag being replaced, including the {all_fields} merge tag.
called by in
- gform_email_background_color_label | filter more info
Use this filter to modify the background color of the "label" row in the table markup generated by the {all_fields} merge tag.
called by in
- gform_email_background_color_data | filter more info
Use this filter to modify the background color of the "data" row (a.k.a. "field value") in the table markup generated by the {all_fields} merge tag.
called by in
- gform_enable_shortcode_notification_message | filter more info
Use this filter to enable or disable the usage of shortcodes in the notification message.
Digging Deeper
By default, Gravity Forms will parse shortcodes in the notification message.
called by GFCommon::send_notification() in common.php
- gform_pre_send_email | filter more info
Use this filter to modify (or disable) an email before it is sent.
Digging Deeper
This filter gives low-level access all notification emails before they are sent. The email object represents the exact data that will be used to send the email, while the $notification object is the template on which the email is based.
You can abort any Gravity Forms email by setting $email['abort_email'] to true and returning the modified $email object.
called by GFCommon::send_email() in common.php
- gform_after_email | action more info
Use this action to excecute code after a Gravity Forms email has been sent.
called by GFCommon::send_email() in common.php
- gform_confirmation_anchor | filter more info
Use this filter to enable or disable the confirmation anchor functionality.
Digging Deeper
By default, the confirmation anchor is disabled unless the form has multiple pages.
The most common need for this filter is when loading a single-page Gravity Forms form lower on the page. The user submits the form and is taken to the top of the page, unable to see the confirmation without scrolling. If you return true with this filter, the page would automatically scroll to the confirmation message when the form is submitted.
called by GFFormDisplay::handle_confirmation() in form_display.php
- gform_confirmation_anchor_{form_id} | filter more info
Form-specific version of the gform_confirmation_anchor filter. Example: gform_confirmation_anchor_1
Use this filter to enable or disable the confirmation anchor functionality.
Digging Deeper
By default, the confirmation anchor is disabled unless the form has multiple pages.
The most common need for this filter is when loading a single-page Gravity Forms form lower on the page. The user submits the form and is taken to the top of the page, unable to see the confirmation without scrolling. If you return true with this filter, the page would automatically scroll to the confirmation message when the form is submitted.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_replace_merge_tags | filter more info
Use this filter to replace default Gravity Forms merge tags before they are replaced by GF.
Digging Deeper
This instance this filter is being called while replacing merge tags in the confirmation message, page, or redirect URL (depending on the confirmation settings you have configured).
called by GFCommon::replace_variables() in common.php
- gform_replace_merge_tags | filter more info
Use this filter to replace custom merge tags.
called by GFCommon::replace_variables_prepopulate() in common.php
- gform_replace_merge_tags | filter more info
Use this filter to replace custom merge tags.
called by GFCommon::replace_variables_prepopulate() in common.php
- gform_confirmation | filter more info
Use this filter to modify the confirmation message or redirect URL.
Digging Deeper
Note: this filter does not allow you to modify the $confirmation object. If the confirmation type is "text", it will pass the parsed confirmation message. If the confirmation type is "page" or "redirect", it will pass the URL to which the user will be redirected. In both cases, merge tags will already be replaced in the passed value.
See the full documentation (click the hook name for link) for more information on expected return values.
called by GFFormDisplay::handle_confirmation() in form_display.php
- gform_confirmation_{form_id} | filter more info
Form-specific version of the gform_confirmation filter. Example: gform_confirmation_1
Use this filter to modify the confirmation message or redirect URL.
Digging Deeper
Note: this filter does not allow you to modify the $confirmation object. If the confirmation type is "text", it will pass the parsed confirmation message. If the confirmation type is "page" or "redirect", it will pass the URL to which the user will be redirected. In both cases, merge tags will already be replaced in the passed value.
See the full documentation (click the hook name for link) for more information on expected return values.
called by GFFormDisplay::handle_confirmation() in form_display.php
- gform_after_submission | action more info
Use this action to execute code after the submission has been successfully processed.
Digging Deeper
This action is only triggered if the form submission is successfully. Form submission with validation errors will not trigger this action.
called by GFFormDisplay::process_form() in form_display.php
- gform_after_submission_{form_id} | action more info
Form-specific version of the gform_after_submission action. Example: gform_after_submission_1
Use this action to execute code after the submission has been successfully processed.
Digging Deeper
This action is only triggered if the form submission is successfully. Form submission with validation errors will not trigger this action.
called by GFFormDisplay::process_form() in form_display.php
- gform_post_process | action more info
Use this action to excecute code after the form submission has been processed.
Digging Deeper
This action will fire on every form submission even if the submission returns a validation error. If you only want to execute code on successful submissions, use gform_after_submission.
called by GFFormDisplay::process_form() in form_display.php
- gform_post_process_{form_id} | action more info
Form-specific version of the gform_post_process action. Example: gform_post_process_1
Use this action to excecute code after the form submission has been processed.
Digging Deeper
This action will fire on every form submission even if the submission returns a validation error. If you only want to execute code on successful submissions, use gform_after_submission.
called by GFFormDisplay::process_form() in form_display.php
Enqueue Scripts more info
It all begins with WordPress' wp_enqueue_scripts action.
This action triggers Gravity Forms' GFFormDisplay::enqueue_scripts() function. In this function, Gravity Forms determines if it needs to load any form scripts. To determine this, Gravity Forms will call the GFFormDisplay::get_embedded_forms() function. This function will search the content of all queried posts for the currrent page for the Gravity Forms shortcode (i.e. [gravityforms id="1" /]).
- gform_pre_enqueue_scripts | action more info
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms has retrieved the form meta and and is now ready to enqueue the neccesary scripts for the forms that have been found. GFFormDisplay::enqueue_form_scripts() will enqueue all form scripts (and styles) required by the current form. The enqueue_form_scripts() method will trigger the "gform_pre_enqueue_scripts" action before the Gravity Forms scripts have been enqueued.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_pre_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_pre_enqueue_scripts action. Example: gform_pre_enqueue_scripts_1
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms has retrieved the form meta and and is now ready to enqueue the neccesary scripts for the forms that have been found. GFFormDisplay::enqueue_form_scripts() will enqueue all form scripts (and styles) required by the current form. The enqueue_form_scripts() method will trigger the "gform_pre_enqueue_scripts" action before the Gravity Forms scripts have been enqueued.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
Digging Deeper
The GFFormDisplay::enqueue_form_scripts() method calls the GFFormDisplay::has_conditional_logic() method to determine whether or not to load Gravity Forms' conditional logic script (conditional_logic.js). The has_conditional_logic() method applys the "gform_has_conditional_logic" filter to allow overriding this check.
This is most commonly used to enable conditional logic on forms with custom-coded conditional logic support rather than disabling conditional logic on forms that are using Gravity Forms' default conditional logic.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
Digging Deeper
The GFFormDisplay::enqueue_form_scripts() method calls the GFFormDisplay::has_conditional_logic() method to determine whether or not to load Gravity Forms' conditional logic script (conditional_logic.js). The has_conditional_logic() method applys the "gform_has_conditional_logic" filter to allow overriding this check.
This is most commonly used to enable conditional logic on forms with custom-coded conditional logic support rather than disabling conditional logic on forms that are using Gravity Forms' default conditional logic.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_enqueue_scripts | action more info
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
Digging Deeper
All form scripts for the current form have now been enqueued.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
- gform_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_enqueue_scripts action. Example: gform_enqueue_scripts_1
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
Digging Deeper
All form scripts for the current form have now been enqueued.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
Form Markup more info
Gravity Forms is ready to render the form markup. The markup for a successful submission is dictated by the confirmation. The following hooks will be executed only for a "Text"-type confirmation. Page and Rediect URL confirmations will simply redirect to the designated URL.
- gform_form_args | filter more info
Use this filter to override the default arguments that will be used to render the form (i.e. "id", "display_title", "display_description", "ajax", "tabindex", etc). These arguments are specified in the shortcode or via the gravity_form() function.
Digging Deeper
The get_form() method applys this filter immediately allowing you to override form display argument before any form markup has been generated.
This would allow you to do things like enable AJAX for all forms or dynamically populate the form via the "field_values" argument.
called by GFFormDisplay::get_form() in form_display.php
- gform_disable_view_counter | filter more info
Use this filter to prevent the current form load from counting as a form view.
Digging Deeper
This is useful in cases where you may be fetching the form markup via the GFFormDisplay::get_form() method (outside of the normal Gravity Forms form load flow) but not displaying it.
called by GFFormDisplay::get_form() in form_display.php
- gform_disable_view_counter_{form_id} | filter more info
Form-specific version of the gform_disable_view_counter filter. Example: gform_disable_view_counter_1
Use this filter to prevent the current form load from counting as a form view.
Digging Deeper
This is useful in cases where you may be fetching the form markup via the GFFormDisplay::get_form() method (outside of the normal Gravity Forms form load flow) but not displaying it.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_render | filter more info
Use this filter to modify the $form object before the form markup is generated.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_render_{form_id} | filter more info
Form-specific version of the gform_pre_render filter. Example: gform_pre_render_1
Use this filter to modify the $form object before the form markup is generated.
called by GFFormDisplay::get_form() in form_display.php
- gform_tabindex | filter more info
Use this filter to modify the tabindex start value (default is 0) or to disable the tabindex attribute.
Digging Deeper
For a helpful snippet on resolving most tabindex issues, see this.
called by GFFormDisplay::get_form() in form_display.php
- gform_tabindex_{form_id} | filter more info
Form-specific version of the gform_tabindex filter. Example: gform_tabindex_1
Use this filter to modify the tabindex start value (default is 0) or to disable the tabindex attribute.
Digging Deeper
For a helpful snippet on resolving most tabindex issues, see this.
called by GFFormDisplay::get_form() in form_display.php
- gform_pre_enqueue_scripts | action more info
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms makes a second call to the GFFormDisplay::enqueue_form_scripts() method so that Gravity Forms scripts/styles are properly enqueued when the form is being loaded via the gravity_form() function call, rather than the shortcode.
If you're loading your form via the shortcode, you can ignore this. It won't cause you any issues.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_pre_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_pre_enqueue_scripts action. Example: gform_pre_enqueue_scripts_1
Use this action to enqueue form scripts before Gravity Forms has enqueued it's own scripts.
Digging Deeper
Gravity Forms makes a second call to the GFFormDisplay::enqueue_form_scripts() method so that Gravity Forms scripts/styles are properly enqueued when the form is being loaded via the gravity_form() function call, rather than the shortcode.
If you're loading your form via the shortcode, you can ignore this. It won't cause you any issues.
called by GFFormsModel::enqueue_form_scripts() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_has_conditional_logic | filter more info
Use this filter to override the GFFormDisplay::has_conditional_logic() check. If conditional logic has been enabled on the current form, this check will return true by default.
called by GFFormDisplay::has_conditional_logic() in form_display.php
- gform_enqueue_scripts | action more info
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
- gform_enqueue_scripts_{form_id} | action more info
Form-specific version of the gform_enqueue_scripts action. Example: gform_enqueue_scripts_1
Use this action to enqueue form scripts after Gravity Forms has enqueued its own scripts. This is the preferred hook to use for enqueueing your own form scripts.
called by GFFormDisplay::enqueue_form_scripts() in form_display.php
- gform_is_form_editor | filter more info
Use this filter to override the GFCommon::is_form_editor() check.
Digging Deeper
Forms are displayed differently depending on the location in which they are loaded.
This filter is applied by the GFCommon::is_form_editor() method. The GFFormDisplay::get_form() method calls the is_form_editor() method to determine if the form is being loaded in the form editor. By default, this will return false if loading the form on the frontend.
called by GFCommon::is_form_editor() in common.php
- gform_is_entry_detail | filter more info
Use this filter to override the GFCommon::is_entry_detail() check.
Digging Deeper
Forms are displayed differently depending on the location in which they are loaded.
This filter is applied by the GFCommon::is_entry_detail() method. The GFFormDisplay::get_form() method calls the is_entry_detail() method to determine if the form is being loaded in the entry detail view. By default, this will return false if loading the form on the frontend.
called by GFCommon::is_entry_detail() in common.php
- gform_progressbar_start_at_zero | filter more info
Use this filter to modify the starting percentage of the progress bar for multi-page forms.
Digging Deeper
This filter defaults to the value of the "Display completed progress bar on confirmation" setting found "Start Paging" field settings. By default, the first page of a multi-page form will show the progress bar partially completed and the last page of the form will show the progress bar fully completed.
If you would like the progress bar to only be fully completed on the confirmation page, enable the "Display completed progress bar on confirmation" setting or use this filter to enable this setting for all forms.
called by GFFormDisplay::get_form() in form_display.php
- gform_shortcode_form | filter more info
Use this filter to modify the complete form markup.
called by GFForms::parse_shortcode() in gravityforms.php