Skip to content

Instantly share code, notes, and snippets.

@matty0501
Created April 25, 2023 11:49
Show Gist options
  • Save matty0501/3938aaa87b09b823aa30a5ee3f24ef30 to your computer and use it in GitHub Desktop.
Save matty0501/3938aaa87b09b823aa30a5ee3f24ef30 to your computer and use it in GitHub Desktop.
<?php
/**
* Save field in uppercase when form is submitted
*/
add_action( 'gform_pre_submission_123', 'gw_capitalize_submitted_data' ); // Replace 123 with your form ID
function gw_capitalize_submitted_data( $form ) {
$input_key = sprintf( 'input_%s', 1 ); // Replace 1 with your field ID
$_POST[ $input_key ] = strtoupper( rgpost( $input_key ) );
return $form;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment