Skip to content

Instantly share code, notes, and snippets.

@mattmcgiv
Created January 11, 2017 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattmcgiv/08dfc652bdef9ce4094425e01a19f308 to your computer and use it in GitHub Desktop.
Save mattmcgiv/08dfc652bdef9ce4094425e01a19f308 to your computer and use it in GitHub Desktop.
add-autocomplete-to-gravity-forms
<?php
add_filter( 'gform_field_content', function ( $field_content, $field ) {
if ( $field->type == 'email' ) {
return str_replace( 'type=', "autocomplete='email' type=", $field_content );
}
if ( $field->type == 'name' ) {
return str_replace( 'type=', "autocomplete='name' type=", $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