WordPress / 'Error: The password field is empty' - How To Fix

If you have used WordPress in Chrome, more than likely you have come across the super annoying 'Error: The password field is empty' problem at least once - […]

Published: Last updated:

By:

If you have used WordPress in Chrome, more than likely you have come across the super annoying 'Error: The password field is empty' problem at least once - if not multiple times per day!

This error occurs when users are logging into WordPress - it looks like Chrome has saved the password for you and you can just log in - however when you click to log in, you get the following error: 'Error: The password field is empty' (as seen in the image above).

Thankfully it is a super easy problem to fix, and equally easy to work around if you are too lazy or unable to add the code to your site.

How to fix the 'Error: The password field is empty' problem

First off, big thanks and appreciation is due to WordPress Stack Exchange user Robbert for his answer to this problem found here.

The easiest way to fix the problem is to add the following to your theme's functions.php file:

add_action("login_form", "kill_wp_attempt_focus");
function kill_wp_attempt_focus() {
    global $error;
    $error = TRUE;
}

This code simulates an error, which in turn stops wp_attempt_focus from working - which is the cause of the issue.

We have tested this code, and can confirm that it stops the 'Error: The password field is empty' problem from occurring.

How to work around the problem

If you cannot access the functions.php file for whatever reason, or your grumpy administrator won't apply the fix for you - there is a quick way to work around the issue.

There are a few ways of doing it - but the quickest is to just click on your username - then select it again from the drop-down list.

Google Chrome should then repopulate the password box with your password.

chevron-down