Fixing the “Password Field is Empty” WordPress Error in Chrome

Fixing the “Password Field is Empty” WordPress Error in Chrome

WordPress errors can be frustrating, but there are usually ways to solve them. One such error involves the WordPress login screen and Google Chrome.

Some users trying to access their WordPress admin panel have found that Google Chrome seemingly auto-fills their password. Hooray for technology! But once they click submit, they get a message along these lines:

ERROR: The password field is empty.

It’s annoying but fixable. Several months ago, StackExchange user Robbert offered three different ways to put this problem in the past. In this post, I’ll go over each of those options so that you can finally ditch this error.

What’s Going On?

Robbert explains that the error stems from the fact that WordPress’s native code interferes with Chrome’s function to fill in your password.

A bit of JavaScript called wp_attempt_focus initiates after the page loads. It simply clears the form so that you have to enter your login credentials yourself.

Chrome, however, automatically fills in your password. It does so in the instant before WordPress clears the form, so Chrome fails to recognize that the form is, in fact, cleared. That’s why it still displays filled-out fields, implying that your password is good to go.

It’s just a mirage though – in reality, your password is gone. Hence when you hit submit, that irksome error pops up.

Now let’s take a look at the three fixes for this issue.

1. Add and Remove a Space Each Time

This is the simplest way to deal with the error, although I should note that it means you’ll have to make sure to follow this step every single time you log in.

All you need to do is click on the password field, after the password, then add a space and delete it. That’s it.

Doing this turns your password from “fake” to “real,” letting you log in.

Doing this every single time can be a hassle, especially if you log into your site regularly. But it can be useful in many instances where you can’t edit your site’s PHP, which the other fixes I’m going to discuss rely on. If you’re having the problem on a blog other than your own, like a client’s site, for instance, this is a viable solution.

2. Edit Your PHP (The Easy Way)

If you can edit your site’s PHP and want to do so, then there’s a relatively easy fix.

Since wp_attempt_focus operates only when a form is error-free, you can just add a smidgen of PHP to simulate an error and prevent the JavaScript from causing you problems in the first place.

All you need to do is edit your theme’s functions.php to add these lines of code:

3. Edit Your PHP (The More Advanced Way)

The one problem with the above solution is that it prevents wp_attempt_focus from working at all, which you might not want to do. If you disable it completely, WordPress will no longer automatically focus on your form.

If you want to avoid that, you can go into functions.php and edit the code to look like this:

This will avoid the password error and give you autofocus, the best of both worlds.


That’s it – three simple ways to solve the “password field is empty” error with WordPress in Google Chrome. Depending on your needs and abilities, one of these solutions should work for you.

Were you able to fix the error? How long has this been bothering you? Let us know in the comments below.