0

I need to remove the auto complete password within the login page. I understand I need to set autocomplete="off". There is another article on this site (How to disable autocomplete on the wp-login.php page) which gives some solutions, but not being all that experienced not sure where to apply the code.

I dont want anything fancy and do not mind editing wp-login.php directly, but where do I put autocomplete="off" and whats the complete syntax please?

EDIT

clearing internet history, when logging in I enter username and password and click, remember me. I log out and back in, it remembers my username and not my password.

IE and Chrome do both ask if I want to remember, and if clicking yes, it remembers username and password.

Adding the code doesn't seem to make a difference to this. Web browser still prompts do you want to remember and works.

function wpse_159462_login_form() {
   echo <<<html <script>
   document.getElementById( "user_pass" ).autocomplete = "off"; </script> 
html; 
}

add_action( 'login_form', 'wpse_159462_login_form' );

I then changed the ID from "user_pass" to "user_login" and the Username is now no remembered, this is workable as the wordpress login isn't remembering anything now.

However looking at the original requirement, here's the background;

The issues is that the site in question had a security audit and raised the following, response has been trimmed

"Password ‘autocomplete’ is enabled on the authentication page for wordpress. The following URL has a form which allow for credentials to be cached by the browser: https://siteremoved/wp-login.php. To prevent the users web browser from prompting users to cache the credentials, the autocomplete=off.

Web browser still asking to remember the logon details. Are there any other options? I know this will be a pain for the users, but I have been informed this is a mandatory requirement for this site.

1

Put and check following code in your theme functions.php and let me know if any query

function wpse_159462_login_form() {
    echo <<<html
<script>
    document.getElementById( "user_pass" ).autocomplete = "off";
</script>
html;
}

add_action( 'login_form', 'wpse_159462_login_form' );
6
  • Have u put your field ID instead of "user_pass" ? – Pratik Patel Sep 27 '18 at 10:43
  • Changed to user_login, now doesnt remember the username, this may be workable. – user151356 Sep 27 '18 at 10:48
  • Excellent! I think this exactly what r you looking for, right ? – Pratik Patel Sep 27 '18 at 10:51
  • I'm new to this site, and needed to provide a more in depth response, so have edited the main question. – user151356 Sep 27 '18 at 10:53
  • I decided to use this also. //Remove remember me from wordpress login add_action('login_head', 'do_not_remember_me'); function do_not_remember_me() { echo '<style type="text/css">.forgetmenot { display:none; }</style>'; } – user151356 Sep 27 '18 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy