Support

Account

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