Modify the settings used to import a form from an XML export file. Useful when adding your own field types with custom settings stored as an array.


add_filter( 'gform_import_form_xml_options', 'my_custom_function' );


  • $options array

    Array of options for the XML import.


In this example we demonstrate how to specify that a custom form setting should be unserialized as an array (rather than an object). This assumes that the setting is created in an array format. When the form is exported to XML it will no longer be in array format so on import we need to specify how it should be formatted.

add_filter( 'gform_import_form_xml_options', 'my_custom_import_xml_options' );
function my_custom_import_xml_options( $options ) {
    $options['my_custom_form_setting'] = array( 'unserialize_as_array' => true );
    return $options;

Source Code

This filter is located in GFExport::import_xml() in export.php