Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example code for caldera_forms_email_csv_data filter in Caldera Forms See: https://calderaforms.com/doc/caldera_forms_email_csv_data/
.<?php
/**
* Change the label of a specific field in Caldera Forms email CSV
*/
add_filter( 'caldera_forms_email_csv_data', function( $csv_data, $form ){
//IMPORTANT change form ID to match your form
if( 'cf123456' === $form[ 'ID' ] ){
$labels = wp_list_pluck( $csv_data , 'label' );
foreach ( $labels as $i => $label ){
if( 'Price' === $label ){
$label = 'Total Price';
$csv_data[ $i ] = $label;
}
}
}
return $csv_data;
}, 10, 2 );
<?php
/**
* Add an additional column to Caldera Forms email CSV
*/
add_filter( 'caldera_forms_email_csv_data', function( $csv_data, $form ){
//IMPORTANT change form ID to match your form
if( 'cf123456' === $form[ 'ID' ] ){
$csv_data[] = array(
'label' => 'Unique ID',
'data' => uniqid( 'prefix' )
);
}
return $csv_data;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.