Allows merge tags to be added/removed from the Merge Tag drop down in the admin.


<script type="text/javascript">
gform.addFilter('gform_merge_tags', 'add_merge_tags');
function add_merge_tags(mergeTags, elementId, hideAllFields, excludeFieldTypes, isPrepop, option){
    //do something here
    return mergeTags;


  • mergeTags object

    The current mergeTags

  • elementId string

    The name of the current field. When selecting the Merge Tag drop down on the Advanced tab of a form field, the value will always be “field_default_value”. The confirmation and notification admin pages will return specific field names so you may target adding a merge tag to a specific field.

  • hideAllFields boolean

    Indicates whether to include the “All Submitted Fields” choice in the Merge Tag drop down.

  • isPrepop boolean

    Indicates whether to include form fields in the Merge Tag drop down.

  • option string

    Internal use by Gravity Forms.


Merge tags are currently grouped as ungrouped, required, optional, pricing, other, custom. Each group has a child object named tags, within tags is tag and label. Label is the text which displays in the merge tag drop down and tag is the merge tag {my_custom_merge_tag}.

This example uses the gform_admin_pre_render filter to load the hook and adds 3 new merge tags to the drop down; two “custom” tags named “My Custom Merge Tag 1” and “My Custom Merge Tag 2”, and one “required” named “My Required Merge Tag 1”.

add_action( ‘gform_admin_pre_render’, ‘add_merge_tags’ );
function add_merge_tags( $form ) {

Source Code

This filter is located in form_admin.js