Field Map Field Type


The field_map type field, part of the Settings API, allows the user to map their form fields to fields you define, e.g. fields you will be sending to a third-party service such as a CRM.


name stringRequired. Name of the field. Use it to retrieve saved data.
labelstringRequired. Field label. Will be displayed in the UI
typestringRequired. Field type. Must be set to field_map for the Field Map field
tooltipstringOptional. Defaults to blank (no tooltip). Displays a question mark icon and a tooltip next to the field label.
field_maparrayRequired. Array that defines the fields to be mapped.
validation_callback(function)Optional. Defaults to nothing (no callback). Calls a function during validation allow for custom validation logic. The example in the existing documentation page is good.


Each item in the field_map array has the following properties:

namestringRequired. Name of the field to be mapped. To be used when retrieving the selected value.
labelstringRequired. Label to be displayed in the UI.
requiredboolOptional. Defaults to false. Possible values are true or false. Marks this field as required, which means it must be mapped to a form field.
default_valuestringOptional. Defaults to blank (nothing is pre-selected). Allowed values are field IDs. When specified, the form field drop down is pre-selected with the appropriate field.


    'title'  => esc_html__( 'This is the title for Section 1', 'sometextdomain' ),
    'fields' => array(
            'name'      => 'contactStandardFields',
            'label'     => esc_html__( 'Map Fields', 'sometextdomain' ),
            'type'      => 'field_map',
            'field_map' => $this->standard_fields_for_feed_mapping(),
            'tooltip'   => '<h6>' . esc_html__( 'Map Fields', 'sometextdomain' ) . '</h6>' . esc_html__( 'Select which Gravity Form fields pair with their respective third-party service fields.', 'sometextdomain' )

Here’s the function being used to define the fields for the field_map property.

public function standard_fields_for_feed_mapping() {
    return array(
            'name'          => 'first_name',
            'label'         => esc_html__( 'First Name', 'sometextdomain' ),
            'required'      => true,
            'field_type'    => array( 'name', 'text', 'hidden' ),
            'default_value' => $this->get_first_field_by_type( 'name', 3 ),
            'name'          => 'last_name',
            'label'         => esc_html__( 'Last Name', 'sometextdomain' ),
            'required'      => true,
            'field_type'    => array( 'name', 'text', 'hidden' ),
            'default_value' => $this->get_first_field_by_type( 'name', 6 ),
            'name'          => 'email_address',
            'label'         => esc_html__( 'Email Address', 'sometextdomain' ),
            'required'      => true,
            'field_type'    => array( 'email', 'hidden' ),
            'default_value' => $this->get_first_field_by_type( 'email' ),

The above code would render the following:



The following functions may come in helpful when interacting with the field_map field type during feed processing.


Retrieves the individual field_map fields from the meta property of the Feed Object for the supplied field name.

$contact_standard_fields = $this->get_field_map_fields( $feed, 'contactStandardFields' );
  • $feed Feed Object

    The Entry Object to be checked.

  • $name string

    The name property of the field_map field to retrieve the mapped fields for.

  • Returns array

    An array containing the field names as the keys to the mapped form field ID or entry meta key.


Retrieves the specified form field or entry meta value. See Accessing Mapped Field Values During Feed Processing for more details.

$first_name = $this->get_field_value( $form, $entry, $contact_standard_fields['first_name'] );