I'm looking for a way to remove the eye icon that shows visibility on login screen (wp-admin and wp-login) and reset password screen (/wp-login.php?action=rp).

As you can see on the screenshot below :

Login Page :

enter image description here

Reset password Page :

enter image description here

Update : I need to remove this button not only the visibility :

enter image description here

Thanks in advance for your reply.



This is one way

add_action('login_head', 'my_remove_eye');

function my_remove_eye() {
        span.dashicons-visibility:before {
        content: "";
  • Is it possible to do the same with reset password page please? – sampaii May 1 '20 at 15:29
  • That code will remove it for both screens – dyg May 1 '20 at 22:39
  • it still visible on reset screen. Another thing. the zone of eye icon is still there. it's just not visible but if we click on the place the eye icon was it appear again.(that's the result with previous code on the login screen) – sampaii May 1 '20 at 22:43
  • can't help you unless you provide a link to the site. In my test the css loads on both pages. To remove the eye completely you could use display:none; instead of content:""; – dyg May 2 '20 at 5:49
  • Can you put the code to do it please? – sampaii May 2 '20 at 8:45

You can use the same mechanism to enqueue some JavaScript that will actually remove the button:

function remove_wp_hide_pw_button() {
if ((document.addEventListener != null) && (document.querySelector != null)) {
    document.addEventListener( 'DOMContentLoaded', function() {
        var b = document.querySelector('button.wp-hide-pw');
        if (b != null) b.remove();
add_action('login_footer', 'remove_wp_hide_pw_button');

However the button will appear briefly then disappear, so you probably do need CSS to hide it the button or icon too.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.