Last active
February 15, 2019 07:58
-
-
Save geshem/35ba9e99ff2392ebb984ace804f3bd08 to your computer and use it in GitHub Desktop.
Gravity Forms Credit Card Field Autofill Fix
This file contains 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
add_filter( 'gform_field_content', function ( $field_content, $field ) { | |
if ( $field->type == 'creditcard' ) { | |
$field_content = str_replace( ".1' id", ".1' autocomplete='cc-number' id", $field_content ); | |
$field_content = str_replace( "_2_month'", "_2_month' autocomplete='cc-exp-month'", $field_content ); | |
$field_content = str_replace( "_2_year'", "_2_year' autocomplete='cc-exp-year'", $field_content ); | |
$field_content = str_replace( ".3' id", ".3' autocomplete='cc-csc' id", $field_content ); | |
$field_content = str_replace( ".5' id", ".5' autocomplete='cc-name' id", $field_content ); | |
} | |
return $field_content; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment