Hi @lindagester,
You can disable autocomplete to all fields by adding the following code in your theme’s function.php file.
function user_registration_add_auto_complete( $args, $key, $value ) {
switch ( $key ) {
default:
$args['custom_attributes']['autocomplete'] = 'off';
break;
}
return $args;
}
add_filter( 'user_registration_form_field_args', 'user_registration_add_auto_complete', 10, 3 );
However, if you want to disable for selective fields you can add their key in “case” of switch condition. Key is the field name in your field option of the field in the form builder
function user_registration_add_auto_complete( $args, $key, $value ) {
switch ( $key ) {
case 'user_email':
case 'user_pass':
$args['custom_attributes']['autocomplete'] = 'off';
break;
}
return $args;
}
add_filter( 'user_registration_form_field_args', 'user_registration_add_auto_complete', 10, 3 );
Thanks & Regards!
-
This reply was modified 7 years, 1 month ago by
Rumesh Udash.
-
This reply was modified 7 years, 1 month ago by
Rumesh Udash.
Thanks, looks great! But unfortunately it doesn’t work. Chrome still tries to autofill the email and password field. I’ve cleared the cache but nothing happens.
-
This reply was modified 7 years, 1 month ago by
lindagester.
Hi @lindagester,
I think you are referring to is Saved Password. It’s not autofill. Sorry, but it’s beyond our control.
Thanks!