Skip to content

Instantly share code, notes, and snippets.

@derekcavaliero
Created December 10, 2021 21:30
Show Gist options
  • Save derekcavaliero/d901e9987a260f5855343c7a8544187c to your computer and use it in GitHub Desktop.
Save derekcavaliero/d901e9987a260f5855343c7a8544187c to your computer and use it in GitHub Desktop.
Gravity Forms - Add CSS Class to Hidden Input Using Input Name
<?php
add_filter( 'gform_field_input', function ( $input, $field, $value, $lead_id, $form_id ) {
if ( $field->inputName !== '' && $field->type == 'hidden' ) {
$input = "<input type='hidden' name='input_{$field->id}' class='{$field->inputName}' value='{$value}'>";
}
return $input;
}, 10, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment