Home › Forums › Backend Issues (wp-admin) › Text field: Disable browser's autocomplete › Reply To: Text field: Disable browser's autocomplete
This has bothered me too, especially in Chrome, because most places you would a password field are not something that would autofill for the site (login, etc). Chrome will automatically try to fill in the password, which removes the existing value. This creates a situation where you can’t save the existing password without disabling autofill in the browser.
To overcome this, here is a quick patch you can put in your functions.php
file.
add_action( 'acf/render_field/type=password', function(){
ob_start();
}, 8);
add_action( 'acf/render_field/type=password', function(){
return str_replace( '<input ', '<input autocomplete="new-password" ', ob_get_clean() );
}, 10);
I think this attribute should be part of the core password field to avoid the situation described above as it is one that I run into with a lot of my clients.
-Mark
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.