gform_form_update_meta

Description

Allows modifying the form meta before it is saved to the database.

Usage

The following would apply to all forms:

add_filter( 'gform_form_update_meta', 'my_import_form', 10, 3 );

To target a specific form, append the form id to the hook name. (format: gform_form_update_meta_FORMID):

add_filter( 'gform_form_update_meta_1', 'my_import_form', 10, 3 );

Parameters

  • $form_meta string
    The meta data for the current form.

  • $form_id int
    The current form ID.

  • $meta_name string
    Meta name.

Example

add_filter( 'gform_form_update_meta', 'my_import_form', 10, 3 );
function my_import_form( $meta, $form_id, $meta_name ) {
$is_import_page           = GFForms::get_page() == 'import_form';
$is_updating_display_meta = $meta_name == 'display_meta';
if( ! $is_import_page || ! $is_updating_display_meta )
return $meta;
$form = $meta;
$form['isImported'] = true;
return $form;
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms version 1.8.8.

Source Code

This filter is located in GFFormsModel::update_form_meta() in forms_model.php.