The “gform_shortcode_$action” filter in Gravity Forms is used to implement custom shortcode actions. The action is specified after “gform_shortcode_”.


Specify the action name after the gform_shortcode_ hook name e.g.

add_filter( 'gform_shortcode_form_property', 'custom_action', 10, 3 );


  • $shortcode_string string

    The full shortcode string.

  • $attributes array

    Array of the shortcode attributes.

        array (
             'id' => '22',
             'name' => 'Poll',
             'action' => 'form_property',
             'property' => 'title'

  • $content string

    The content text of the shortcode if it exists.


The example below has the following shortcode setup on a page:

[gravityform id="22" name="Poll" action="form_property" property="title"]
my content

…and uses the following hook setup with the action “form_property”. The “property” is retrieved and used to display the title of the form.

add_filter( 'gform_shortcode_form_property', 'custom_action', 10, 3 );
function custom_action( $string, $attributes, $content ) {
    //get the shortcode attributes into variables, default values set for some
    //the "property" attribute set in the shortcode has been added to the shortcode array
    extract( shortcode_atts( array(
         'title' => true,
         'description' => true,
         'id' => 0,
         'name' => *,
         'field_values' => "",
         'ajax' => false,
         'tabindex' => 1,
         'action' => 'form',
         'property' => *
    ), $attributes ) );
    $form = RGFormsModel::get_form_meta( $id ); //get the form object
    $property_value = $form[ $property ]; //retrieve the "property" from the form object
    $info = "The property to retrieve is {$property} with value {$property_value}.";
    return $info;


This code may be placed in the functions.php file of your active theme OR in your plugin code.

Source Code

This filter is located in GFForms::parse_shortcode() in gravityforms.php.

Last modified: March 11, 2018