Skip to content

Instantly share code, notes, and snippets.

@robin-scott
Created December 29, 2017 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robin-scott/60e95005d9dbf000f2cd8020fc4a30f4 to your computer and use it in GitHub Desktop.
Save robin-scott/60e95005d9dbf000f2cd8020fc4a30f4 to your computer and use it in GitHub Desktop.
Remove unwanted fields from Gravity Forms exports
// Remove unwanted fields from Gravity Forms export - updated by Robin Scott of Silicon Dales
add_filter( 'gform_export_fields', function ( $form ) {
// array of field IDs I never want to see on the export page
$fields_to_remove = array(
'payment_amount',
'payment_date',
'payment_status',
'transaction_id',
'user_agent',
'ip',
'post_id',
'transaction_id',
'source_url',
'date_created',
);
foreach ( $form['fields'] as $key => $field ) {
$field_id = is_object( $field ) ? $field->id : $field['id'];
if ( in_array( $field_id, $fields_to_remove ) ) {
unset ( $form['fields'][ $key ] );
}
}
// always return the form
return $form;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment