Created
August 19, 2024 18:06
-
-
Save itsmereal/dceebd121460e3caee160b1c04b5ccdb to your computer and use it in GitHub Desktop.
Add Class to Gravity Form Hidden Fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gform_field_input', function ( $input, $field, $value, $lead_id, $form_id ) { | |
if ( $field->inputName !== '' && $field->type == 'hidden' ) { | |
$input = "<input type='hidden' id='input_{$form_id}_{$field->id}' 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