Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hirejordansmith/8f68ed61b76acb6b5ed87b3d30501c2b to your computer and use it in GitHub Desktop.
Save hirejordansmith/8f68ed61b76acb6b5ed87b3d30501c2b to your computer and use it in GitHub Desktop.
Gravity Forms // gform_pre_submission filter based on field CSS class
<?php
add_action( 'gform_pre_submission', 'pre_submission_handler_one' );
function pre_submission_handler_one( $form ) {
foreach ( $form['fields'] as $field ) {
$cssClass = $field->cssClass;
if ( strpos($cssClass, 'test') !== false) {
$field_id = $field->id;
$date = new DateTime( 'now' );
$_POST["input_$field_id"] = $date->format('U');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment