GravityExport Developer Hooks
These are the developer hooks available in GravityExport Lite and GravityExport. All code is provided as examples and should be tested before being used. See how to add custom PHP to your site. For the complete reference of every action and filter, see the GravityExport section of the GravityKit developer documentation.
Most hooks use gf_apply_filters() , so they are also available with _{form_id} added to the filter name (example: gfexcel_renderer_matrix_{form_id}). Using the form filters will only modify values associated with that specific form.
gfexcel_renderer_matrix #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Modify the export matrix before it’s rendered. The matrix is a two-dimensional array containing header row and all entry data rows.
| Property | Type | Default | Description |
|---|---|---|---|
$matrix | array | N/A | Two-dimensional array with row 0 as header, rows 1+ as data |
$form | array | N/A | Gravity Forms form object |
Matrix Structure
The matrix is a two-dimensional array where:
- Row 0 (Header): Contains column header objects (
GFExcelValuesStringValue) - Row 1+ (Data): Contains entry data as value objects
Each cell in the matrix is an implementation of the GFExcelValuesBaseValue object, for example:
GFExcelValuesStringValue– Text valuesGFExcelValuesNumericValue– Numeric values (Entry ID, User ID, etc.)
Value Object Properties
All value objects extend from a base class and include:
| Property | Type | Access | Description |
|---|---|---|---|
value | mixed | protected | The actual cell value |
gf_field | GF_Field | protected | Associated Gravity Forms field object |
is_numeric | bool | protected | Whether value should be formatted as number |
color | string | protected | Text color |
background_color | string | protected | Cell background color |
is_bold | bool | protected | Bold formatting |
is_italic | bool | protected | Italic formatting |
url | string | protected | Hyperlink URL |
Removing columns with only empty values
This code filters out columns from being included in the export where all the values in the column are empty.
/**
* Remove empty columns from the matrix.
*
* Filters out columns where all values (excluding the header) are empty.
*
* @since 1.0.0
*
* @param array $matrix The matrix containing all rows and columns. First row is the header.
* @param array $form The form object (unused; required by filter signature).
*
* @return array The matrix with empty columns removed.
*/
function gfexcel_remove_empty_columns( $matrix, $form ) {
if ( empty( $matrix ) || count( $matrix ) < 2 ) {
return $matrix; // Need header + at least one data row.
}
/**
* Determine whether a cell value should be considered empty.
*
* Preserves 0, '0', 0.0, and false as non-empty.
*
* @param mixed $value The value to check.
* @return bool
*/
$is_empty = static function( $value ): bool {
// Unwrap GFExcel value objects.
if ( is_object( $value ) && method_exists( $value, 'getValue' ) ) {
$value = $value->getValue();
}
// Empty arrays are empty; non-empty arrays are not.
if ( is_array( $value ) ) {
return count( $value ) === 0;
}
if ( is_string( $value ) ) {
return '' === trim( $value );
}
return $value === null || $value === '';
};
$data_rows = array_slice( $matrix, 1 );
$column_count = count( $matrix[0] );
$columns_to_keep = [];
// Find columns with at least one non-empty value.
for ( $col_index = 0; $col_index < $column_count; $col_index++ ) {
foreach ( $data_rows as $row ) {
$val = $row[ $col_index ] ?? null;
if ( ! $is_empty( $val ) ) {
$columns_to_keep[] = $col_index;
continue 2; // Skip to next column.
}
}
}
// Rebuild matrix keeping only non-empty columns.
if ( empty( $columns_to_keep ) ) {
// All columns empty: return empty rows with no columns.
return array_fill( 0, count( $matrix ), [] );
}
$keep_flip = array_flip( $columns_to_keep );
return array_map(
static function( $row ) use ( $keep_flip ) {
return array_values( array_intersect_key( $row, $keep_flip ) );
},
$matrix
);
}
add_filter( 'gfexcel_renderer_matrix', 'gfexcel_remove_empty_columns', 10, 2 );Removing the header row
If you want to remove the header row from GravityKit export, add this code to your site. This will remove the first row.
/**
* Remove the values from the first row of the matrix. The columns still exist, but the values are empty. This removes the first (header) row.
* @param mixed[] $matrix The matrix containing all rows and columns.
* @return mixed[] The matrix containing all rows and columns.
*/
add_filter( 'gfexcel_renderer_matrix', function( $matrix ) {
unset( $matrix[0] ); // Unset the first row. Doesn't remove the row, only the values.
return array_values( $matrix ); // Re-indexes the array to start at 0, removing the first row.
}, 10, 1 );gfexcel_renderer_hide_row #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Hide specific rows from the export based on custom logic.
| Property | Type | Default | Description |
|---|---|---|---|
$hide | bool | false | Whether to hide the row |
$row | array | N/A | Array of cell values for the current row |
$form_id | int | N/A | The form ID |
Sample code
/**
* Hide rows where field 1 is empty.
*
* @param bool $hide Whether to hide the row.
* @param array $row The row data.
* @param int $form_id The form ID.
* @return bool True to hide the row.
*/
function gravityexport_hide_empty_field_rows( $hide, $row, $form_id ) {
foreach ( $row as $column ) {
if ( 1 === $column->getFieldId() && empty( $column->getValue() ) ) {
return true;
}
}
return $hide;
}
add_filter( 'gfexcel_renderer_hide_row', 'gravityexport_hide_empty_field_rows', 10, 3 );gfexcel_renderer_columns_max_width #
Applies to: Excel (.xlsx), PDF (.pdf)
Set the maximum width for auto-sized columns in the export.
| Property | Type | Default | Description |
|---|---|---|---|
$max_width | int|null | null | Maximum column width in Excel units (null = no limit) |
Sample code
/**
* Limit column width to 50 units.
*
* @param int|null $max_width The maximum column width.
* @return int The new maximum width.
*/
function gravityexport_set_max_column_width( $max_width ) {
return 50;
}
add_filter( 'gfexcel_renderer_columns_max_width', 'gravityexport_set_max_column_width' );gfexcel_renderer_wrap_text #
Applies to: Excel (.xlsx), PDF (.pdf)
Control whether cell text should wrap.
| Property | Type | Default | Description |
|---|---|---|---|
$wrap_text | bool | true | Whether to wrap text in cells |
$cell | Cell | N/A | PhpSpreadsheet Cell object |
$value | BaseValue|mixed | N/A | The cell value object or raw value |
$form_id | int | N/A | The form ID |
Sample code
/**
* Disable text wrapping for all cells.
*
* @param bool $wrap_text Whether to wrap text.
* @param Cell $cell The cell object.
* @param mixed $value The cell value.
* @param int $form_id The form ID.
* @return bool False to disable text wrapping.
*/
function gravityexport_disable_text_wrap( $wrap_text, $cell, $value, $form_id ) {
return false;
}
add_filter( 'gfexcel_renderer_wrap_text', 'gravityexport_disable_text_wrap', 10, 4 );gfexcel_renderer_worksheet_title #
Applies to: Excel (.xlsx), PDF (.pdf)
Customize the worksheet/tab name in the Excel file, or the document title in PDF exports.
| Property | Type | Default | Description |
|---|---|---|---|
$title | string | Form title | Worksheet title (max 30 characters) |
$form | array | N/A | The form object |
$form_id | int | N/A | The form ID |
Sample code
/**
* Add form ID to worksheet title.
*
* @param string $title The worksheet title.
* @param array $form The form object.
* @param int $form_id The form ID.
* @return string Modified worksheet title.
*/
function gravityexport_custom_worksheet_title( $title, $form, $form_id ) {
return sprintf( 'Form %d - %s', $form_id, $title );
}
add_filter( 'gfexcel_renderer_worksheet_title', 'gravityexport_custom_worksheet_title', 10, 3 );gfexcel_renderer_disable_hyperlinks #
Applies to: Excel (.xlsx), PDF (.pdf)
Disable hyperlinks in the export globally.
| Property | Type | Default | Description |
|---|---|---|---|
$disable | bool | false | Whether to disable all hyperlinks |
Sample code
/**
* Disable all hyperlinks in export.
*
* @return bool True to disable hyperlinks.
*/
add_filter( 'gfexcel_renderer_disable_hyperlinks', '__return_true' );gfexcel_output_rows #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Modify the rows before they’re processed into the matrix.
| Property | Type | Default | Description |
|---|---|---|---|
$rows | array | N/A | Array of entry rows |
$form | array | N/A | The form object |
$form_id | int | N/A | The form ID |
Sample code
/**
* Filter out test entries from export.
*
* @param array $rows The entry rows.
* @param array $form The form object.
* @param int $form_id The form ID.
* @return array Filtered rows.
*/
function gravityexport_remove_test_entries( $rows, $form, $form_id ) {
return array_filter( $rows, function( $row ) {
// Remove entries with "test" in field 1
return false === stripos( $row[1], 'test' );
} );
}
add_filter( 'gfexcel_output_rows', 'gravityexport_remove_test_entries', 10, 3 );gfexcel_output_columns #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Modify which columns are included in the export.
| Property | Type | Default | Description |
|---|---|---|---|
$columns | array | N/A | Array of column field objects |
$form | array | N/A | The form object |
$form_id | int | N/A | The form ID |
Sample code
/**
* Remove specific columns from export.
*
* @param array $columns The column fields.
* @param array $form The form object.
* @param int $form_id The form ID.
* @return array Modified columns.
*/
function gravityexport_remove_admin_columns( $columns, $form, $form_id ) {
return array_filter( $columns, function( $column ) {
// Remove admin-only fields
return ! in_array( $column->id, [ 'ip', 'user_agent' ], true );
} );
}
add_filter( 'gfexcel_output_columns', 'gravityexport_remove_admin_columns', 10, 3 );gfexcel_output_search_criteria #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Modify the search criteria used to fetch entries for export.
| Property | Type | Default | Description |
|---|---|---|---|
$search_criteria | array | ['status' => 'active'] | GFAPI search criteria array |
$form_id | int | N/A | The form ID |
$feed_id | int | N/A | The feed ID (if applicable) |
Sample code
/**
* Only export entries from last 30 days.
*
* @param array $search_criteria The search criteria.
* @param int $form_id The form ID.
* @param int $feed_id The feed ID.
* @return array Modified search criteria.
*/
function gravityexport_last_30_days( $search_criteria, $form_id, $feed_id ) {
$search_criteria['start_date'] = date( 'Y-m-d', strtotime( '-30 days' ) );
$search_criteria['end_date'] = date( 'Y-m-d' );
return $search_criteria;
}
add_filter( 'gfexcel_output_search_criteria', 'gravityexport_last_30_days', 10, 3 );gfexcel_output_sorting_options #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Customize how entries are sorted in the export.
| Property | Type | Default | Description |
|---|---|---|---|
$sorting | array | ['key' => 'date_created', 'direction' => 'ASC'] | Sorting configuration |
$form_id | int | N/A | The form ID |
$feed_id | int | N/A | The feed ID (if applicable) |
Sample code
/**
* Sort by entry ID descending.
*
* @param array $sorting The sorting options.
* @param int $form_id The form ID.
* @param int $feed_id The feed ID.
* @return array Modified sorting options.
*/
function gravityexport_sort_by_id_desc( $sorting, $form_id, $feed_id ) {
return [
'key' => 'id',
'direction' => 'DESC',
];
}
add_filter( 'gfexcel_output_sorting_options', 'gravityexport_sort_by_id_desc', 10, 3 );gfexcel_field_checkbox_empty #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Define the value to use for empty checkbox fields.
| Property | Type | Default | Description |
|---|---|---|---|
$empty_value | string | '' | Value to use for unchecked checkboxes |
$field | GF_Field | N/A | The checkbox field object |
$form_id | int | N/A | The form ID |
Sample code
/**
* Use "No" for empty checkboxes.
*
* @param string $empty_value The empty value.
* @param GF_Field $field The field object.
* @param int $form_id The form ID.
* @return string The new empty value.
*/
function gravityexport_checkbox_empty_no( $empty_value, $field, $form_id ) {
return 'No';
}
add_filter( 'gfexcel_field_checkbox_empty', 'gravityexport_checkbox_empty_no', 10, 3 );gfexcel_field_date_format #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Customize the date format for date fields in the export.
| Property | Type | Default | Description |
|---|---|---|---|
$format | string | Field format | PHP date format string |
$field | GF_Field | N/A | The date field object |
$form_id | int | N/A | The form ID |
$input_id | string | N/A | The input ID (for multi-input fields) |
Sample code
/**
* Use ISO 8601 date format.
*
* @param string $format The date format.
* @param GF_Field $field The field object.
* @param int $form_id The form ID.
* @param string $input_id The input ID.
* @return string The new date format.
*/
function gravityexport_iso_date_format( $format, $field, $form_id, $input_id ) {
return 'Y-m-d';
}
add_filter( 'gfexcel_field_date_format', 'gravityexport_iso_date_format', 10, 4 );gfexcel_combiner_glue #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Customize the separator used when combining multi-value fields.
| Property | Type | Default | Description |
|---|---|---|---|
$glue | string | ', ' | String used to join multiple values |
$field_type | string | N/A | The field type (e.g., ‘checkbox’, ‘multiselect’) |
$field_id | int | N/A | The field ID |
$form_id | int | N/A | The form ID |
Sample code
/**
* Use semicolon separator for checkbox fields.
*
* @param string $glue The separator string.
* @param string $field_type The field type.
* @param int $field_id The field ID.
* @param int $form_id The form ID.
* @return string The new separator.
*/
function gravityexport_semicolon_separator( $glue, $field_type, $field_id, $form_id ) {
if ( 'checkbox' === $field_type ) {
return '; ';
}
return $glue;
}
add_filter( 'gfexcel_combiner_glue', 'gravityexport_semicolon_separator', 10, 4 );gfexcel_file_extension #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Set the file extension/format for a specific form’s exports.
| Property | Type | Default | Description |
|---|---|---|---|
$extension | string | 'xlsx' | File extension (‘xlsx’, ‘csv’, or ‘pdf’) |
$form | array | N/A | The form object |
Sample code
/**
* Use CSV format for form ID 5.
*
* @param string $extension The file extension.
* @param array $form The form object.
* @return string The file extension.
*/
function gravityexport_csv_for_form_5( $extension, $form ) {
if ( 5 === (int) rgar( $form, 'id' ) ) {
return 'csv';
}
return $extension;
}
add_filter( 'gfexcel_file_extension', 'gravityexport_csv_for_form_5', 10, 2 );gfexcel_file_extensions #
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Register available file format extensions that the plugin recognizes.
| Property | Type | Default | Description |
|---|---|---|---|
$extensions | array | ['xlsx', 'csv'] | Array of supported extensions |
Sample code
/**
* Add custom export format.
*
* @param array $extensions Supported extensions.
* @return array Modified extensions array.
*/
function gravityexport_add_custom_format( $extensions ) {
$extensions[] = 'ods'; // OpenDocument Spreadsheet
return $extensions;
}
add_filter( 'gfexcel_file_extensions', 'gravityexport_add_custom_format' );CSV-Specific Filters #
The following filters only apply to CSV (.csv) exports.
gfexcel_renderer_csv_delimiter
Applies to: CSV (.csv) only
Set the CSV delimiter character.
| Property | Type | Default | Description |
|---|---|---|---|
$delimiter | string | ',' | CSV delimiter character |
$form_id | int | N/A | The form ID |
Sample code
/**
* Use semicolon delimiter for CSV.
*
* @param string $delimiter The delimiter.
* @param int $form_id The form ID.
* @return string The new delimiter.
*/
function gravityexport_semicolon_delimiter( $delimiter, $form_id ) {
return ';';
}
add_filter( 'gfexcel_renderer_csv_delimiter', 'gravityexport_semicolon_delimiter', 10, 2 );gfexcel_renderer_csv_enclosure
Applies to: CSV (.csv) only
Set the CSV enclosure character.
| Property | Type | Default | Description |
|---|---|---|---|
$enclosure | string | '"' | CSV enclosure character |
$form_id | int | N/A | The form ID |
gfexcel_renderer_csv_line_ending
Applies to: CSV (.csv) only
Set the CSV line ending character(s).
| Property | Type | Default | Description |
|---|---|---|---|
$line_ending | string | "rn" | CSV line ending |
$form_id | int | N/A | The form ID |
gfexcel_renderer_csv_use_bom
Applies to: CSV (.csv) only
Control whether to include BOM (Byte Order Mark) in CSV.
| Property | Type | Default | Description |
|---|---|---|---|
$use_bom | bool | false | Whether to include UTF-8 BOM |
$form_id | int | N/A | The form ID |
Sample code
/**
* Add UTF-8 BOM for Excel compatibility.
*
* @param bool $use_bom Whether to use BOM.
* @param int $form_id The form ID.
* @return bool True to include BOM.
*/
function gravityexport_enable_bom( $use_bom, $form_id ) {
return true;
}
add_filter( 'gfexcel_renderer_csv_use_bom', 'gravityexport_enable_bom', 10, 2 );gfexcel_renderer_csv_include_separator_line
Applies to: CSV (.csv) only
Include a separator line at the top of CSV files.
| Property | Type | Default | Description |
|---|---|---|---|
$include | bool | false | Whether to include separator line |
$form_id | int | N/A | The form ID |
gfexcel_renderer_csv_output_encoding
Applies to: CSV (.csv) only
Set the CSV output encoding.
| Property | Type | Default | Description |
|---|---|---|---|
$encoding | string | 'UTF-8' | Output encoding |
$form_id | int | N/A | The form ID |
Advanced Filters #
gfexcel_value_type
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Change the value object class used to render a specific field’s data.
| Property | Type | Default | Description |
|---|---|---|---|
$type | string | Field-dependent | Value class name (e.g., ‘StringValue’, ‘NumericValue’) |
$field_type | string | N/A | The field input type |
$form_id | int | N/A | The form ID |
$field_id | int | N/A | The field ID |
$gf_field | GF_Field | N/A | The field object |
$is_label | bool | false | Whether this value object is for a label |
gfexcel_field_separated
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Control whether a field should be split into separate columns (applies to Name, Address, and similar multi-part fields).
| Property | Type | Default | Description |
|---|---|---|---|
$separated | bool | Settings-dependent | Whether to separate into multiple columns |
$field_type | string | N/A | The field input type (e.g., ‘name’, ‘address’) |
$form_id | int | N/A | The form ID |
$field_id | int | N/A | The field ID |
$field | GF_Field | N/A | The field object |
Sample code
/**
* Keep name field as single column.
*
* @param bool $separated Whether to separate.
* @param string $field_type The field input type.
* @param int $form_id The form ID.
* @param int $field_id The field ID.
* @param GF_Field $field The field object.
* @return bool False to keep as single column.
*/
function gravityexport_single_name_column( $separated, $field_type, $form_id, $field_id, $field ) {
if ( 'name' === $field_type ) {
return false;
}
return $separated;
}
add_filter( 'gfexcel_field_separated', 'gravityexport_single_name_column', 10, 5 );gfexcel_field_label
Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)
Customize field labels (column headers) in the export.
| Property | Type | Default | Description |
|---|---|---|---|
$label | string | Field label | The column header label |
$field_type | string | N/A | The field input type |
$form_id | int | N/A | The form ID |
$field_id | int | N/A | The field ID |
$field | GF_Field | N/A | The field object |
Sample code
/**
* Add field ID to column headers.
*
* @param string $label The field label.
* @param string $field_type The field input type.
* @param int $form_id The form ID.
* @param int $field_id The field ID.
* @param GF_Field $field The field object.
* @return string Modified label.
*/
function gravityexport_add_id_to_label( $label, $field_type, $form_id, $field_id, $field ) {
return sprintf( '%s (ID: %d)', $label, $field_id );
}
add_filter( 'gfexcel_field_label', 'gravityexport_add_id_to_label', 10, 5 );Actions #
gfexcel_renderer_cell_properties
Applies to: Excel (.xlsx), PDF (.pdf)
Modify cell properties directly using PhpSpreadsheet API.
| Property | Type | Description |
|---|---|---|
$cell | Cell | PhpSpreadsheet Cell object |
$value | BaseValue|mixed | The cell value object or raw value |
$form_id | int | The form ID |
Sample code
/**
* Make header row bold with background color.
*
* @param Cell $cell The cell object.
* @param mixed $value The cell value.
* @param int $form_id The form ID.
*/
function gravityexport_style_header_row( $cell, $value, $form_id ) {
if ( 1 !== $cell->getRow() ) {
return;
}
$cell->getStyle()->getFont()->setBold( true );
$cell->getStyle()->getFill()
->setFillType( PhpOfficePhpSpreadsheetStyleFill::FILL_SOLID )
->getStartColor()->setRGB( 'CCCCCC' );
}
add_action( 'gfexcel_renderer_cell_properties', 'gravityexport_style_header_row', 10, 3 );GravityExport Save hooks #
The hooks below apply to Save feeds rather than to the file renderers above. The first three were added in GravityExport 1.15.0 (Google Sheets export, connection monitoring, and copying feeds to other forms). The four that follow cover scheduled and manual export runs; each entry notes the version it was added in.
gk/gravityexport/sheets/rows-page
Applies to: Google Sheets export (filter)
Modify each page of rows before it is written to Google Sheets. The filter fires once per page, so a listener sees part of the export at a time and should not assume it is looking at the whole sheet or at the header row.
| Property | Type | Description |
|---|---|---|
$rows | array[] | The page’s rows of scalar values |
$form_id | int | The form being exported |
$offset | int | Number of entries skipped before this page |
Sample code
/**
* Write "N/A" instead of an empty cell for form 12.
*
* @param array[] $rows The page's rows.
* @param int $form_id The form ID.
* @param int $offset Entries skipped before this page.
* @return array[] Modified rows.
*/
function gravityexport_sheets_fill_blanks( $rows, $form_id, $offset ) {
if ( 12 !== (int) $form_id ) {
return $rows;
}
foreach ( $rows as &$row ) {
foreach ( $row as &$cell ) {
if ( '' === $cell ) {
$cell = 'N/A';
}
}
}
return $rows;
}
add_filter( 'gk/gravityexport/sheets/rows-page', 'gravityexport_sheets_fill_blanks', 10, 3 );gk/gravityexport/save/monitored-connection/failed
Applies to: Cloud storage connections with Monitor connections enabled (action)
Fires when a monitored cloud storage connection (Google Sheets, Dropbox, or Box) is found to be offline. Use it to notify someone or log the outage. It fires once when the connection changes state, not on every check.
| Property | Type | Description |
|---|---|---|
$provider | MonitorableConnection | The offline connection. getId() returns its slug and getTitle() its display name |
Sample code
/**
* Email the site admin when a cloud connection goes offline.
*
* @param MonitorableConnection $provider The offline connection.
*/
function gravityexport_notify_connection_offline( $provider ) {
wp_mail(
get_option( 'admin_email' ),
sprintf( 'GravityExport: %s connection is offline', $provider->getTitle() ),
'Reconnect it under GravityKit > Settings > GravityExport before scheduled exports fail.'
);
}
add_action( 'gk/gravityexport/save/monitored-connection/failed', 'gravityexport_notify_connection_offline' );gk/gravityexport/save/feed-copy/unknown-key
Applies to: The Copy to Other Forms bulk action on Save feeds (filter)
Decide whether a feed meta key the copier does not recognize (for example, one added by your own code) is copied to the target form or dropped. Return 'copy' or 'drop'. The default is 'copy'.
| Property | Type | Description |
|---|---|---|
$action | string | The action to take. Default 'copy'; accepts 'copy' or 'drop' |
$key | string | The unrecognized meta key |
$value | mixed | The value stored under the key |
$source_meta | array | The full source feed meta |
$target_form_id | int | The form the feed is being copied to |
Sample code
/**
* Don't carry a per-form note over when a feed is copied.
*
* @param string $action 'copy' or 'drop'.
* @param string $key The unrecognized meta key.
* @param mixed $value Its value.
* @param array $source_meta The source feed meta.
* @param int $target_form_id The target form ID.
* @return string 'copy' or 'drop'.
*/
function gravityexport_drop_note_on_copy( $action, $key, $value, $source_meta, $target_form_id ) {
if ( 'my_plugin_form_note' === $key ) {
return 'drop';
}
return $action;
}
add_filter( 'gk/gravityexport/save/feed-copy/unknown-key', 'gravityexport_drop_note_on_copy', 10, 5 );gk/gravityexport/save/cron/completed
Applies to: Scheduled export runs (action, since 1.7.0)
Fires after a scheduled export finishes successfully, whether it ran in one pass or in chunks. Only scheduled runs fire it. Exports triggered by a new entry, a webhook, or Export Now do not.
| Property | Type | Description |
|---|---|---|
$feed | array | The Gravity Forms feed array |
$row_count | int | The number of rows exported |
Sample code
/**
* Log every successful scheduled export.
*
* @param array $feed The Gravity Forms feed array.
* @param int $row_count The number of rows exported.
*/
function gravityexport_log_scheduled_export( $feed, $row_count ) {
error_log( sprintf(
'GravityExport: feed %d on form %d exported %d rows.',
$feed['id'],
$feed['form_id'],
$row_count
) );
}
add_action( 'gk/gravityexport/save/cron/completed', 'gravityexport_log_scheduled_export', 10, 2 );gk/gravityexport/save/cron/failed
Applies to: Scheduled export runs (action, since 1.7.0)
Fires after a scheduled export fails. Use it to alert someone or log the error. GravityExport catches anything your listener throws so it cannot hide the original failure, and the feed’s Activity Log and Failure Alerts still record the run.
| Property | Type | Description |
|---|---|---|
$feed | array | The Gravity Forms feed array |
$e | \Throwable | The error or exception that caused the failure |
Sample code
/**
* Email the site admin when a scheduled export fails.
*
* @param array $feed The Gravity Forms feed array.
* @param \Throwable $e The error or exception that caused the failure.
*/
function gravityexport_notify_export_failed( $feed, $e ) {
wp_mail(
get_option( 'admin_email' ),
sprintf( 'GravityExport: scheduled export failed for feed %d', $feed['id'] ),
$e->getMessage()
);
}
add_action( 'gk/gravityexport/save/cron/failed', 'gravityexport_notify_export_failed', 10, 2 );gk/gravityexport/save/exported/manual
Applies to: Runs started with Export Now on the feed list, or through the save-feed action below (action, since 1.6.0)
Fires after a manually triggered export completes. It does not fire for scheduled, webhook, or entry-triggered runs.
| Property | Type | Description |
|---|---|---|
$feed | array | The Gravity Forms feed array |
Sample code
/**
* Log manual export runs.
*
* @param array $feed The Gravity Forms feed array.
*/
function gravityexport_log_manual_export( $feed ) {
error_log( sprintf( 'GravityExport: feed %d was exported manually.', $feed['id'] ) );
}
add_action( 'gk/gravityexport/save/exported/manual', 'gravityexport_log_manual_export' );gk/gravityexport/save/action/save-feed
Applies to: Your own code (an action you call, since 1.15.0)
Call this action to run a Save feed on demand, for example from a WP-CLI command, a custom REST endpoint, or a WP Crontrol event. The feed must be an All Entries feed with a Scheduled or Webhook trigger; feeds set to Automatic are ignored. When the run succeeds, gk/gravityexport/save/exported/manual fires.
| Property | Type | Description |
|---|---|---|
$feed_id | int | The ID of the Save feed to run |
Sample code
/**
* Run Save feed 42 right now, for example from a custom WP-CLI command.
*/
do_action( 'gk/gravityexport/save/action/save-feed', 42 );- gfexcel_renderer_matrix
- gfexcel_renderer_hide_row
- gfexcel_renderer_columns_max_width
- gfexcel_renderer_wrap_text
- gfexcel_renderer_worksheet_title
- gfexcel_renderer_disable_hyperlinks
- gfexcel_output_rows
- gfexcel_output_columns
- gfexcel_output_search_criteria
- gfexcel_output_sorting_options
- gfexcel_field_checkbox_empty
- gfexcel_field_date_format
- gfexcel_combiner_glue
- gfexcel_file_extension
- gfexcel_file_extensions
- CSV-Specific Filters
- Advanced Filters
- Actions
- GravityExport Save hooks