While WordPress is an incredibly powerful platform, it does come with its share of occasional errors and bugs. One potential source of grievance among WordPress users is the inability to log into the WordPress admin area. There are many reasons why WordPress login issues might arise, some more common than others.
This article will highlight some of the most commonly experienced login issues, explain why they may occur, and offer appropriate solutions.
Let’s get started!
Subscribe To Our Youtube Channel
6 Common WordPress Login Issues
WordPress login issues can come in many shapes. However, one common thread that they have in common is that they’re usually relatively easy to fix. For this section, we’ll go over each potential WordPress login issue from easiest to hardest to solve.
1. Lost or Forgotten Password
This is an obvious one, of course, but nonetheless a common problem. If you change your password regularly to help with site security, it’s very easy to forget or lose track of your current password. While WordPress has a built-in feature to help you reset your password, there are a number of factors that can derail that process. As a result, there are actually quite a few different potential solutions that you may have to run through.
How to Recover a Lost or Forgotten Password
If you’ve lost or forgotten your password, you can first try using the built-in recovery feature. Click on Lost your password? on the login screen and you will be prompted to enter your email address. WordPress will send you a link via email, which you can use to create a new password:
If for some reason you can’t use this method, there are two other tricks you can try.
First, if you’ve used multiple browsers or devices to log into WordPress, check to see if any of those browsers or devices are still logged in. Then access the admin panel and change your password.
If that doesn’t work, your next best option is to update your password directly in the WordPress database. Most web hosts will provide you with access to database management software, such as phpMyAdmin. You can use that software to directly edit values within the database, including your password.
However, before you edit your WordPress database, create a complete backup of your site using a reputable migration plugin. Then proceed on to the following steps:
- Launch phpMyAdmin, locate your site’s database, and open up the
wp_users
table. - In the list of users, locate your username in the
user_login
column and select Edit next to that row. - Find the
user_pass
field and type a new plain text password into the Value field, replacing the existing symbols and characters. - From the drop-down menu, select MD5.
- Scroll to the bottom of the page and click on Go.
At this point, you should be able to log in using the new password you just assigned to your WordPress username with phpMyAdmin:
However, if you’re still locked out and unable to recover your password, there are several additional options you can try.
Cookies are small files located in browser directories that store information about a user’s interaction with specific websites. WordPress requires the use of cookies during the login process. If cookies are not enabled, WordPress login can’t occur.
The browser cache refers to the temporary files stored on your web browser when you access a web page. If your cache is not updating properly, you may be viewing older versions of some of the files that support WordPress.
How to Clear Your Browser’s Cache and Cookies
Luckily, cache and cookie-related WordPress login issues are usually easily fixed. First, check to make sure that cookies are enabled, and then clear your cache and cookies.
3. Plugin Interference
It’s possible for a plugin to interfere with the login process. A plugin may not have been updated properly, or there could be a conflict between two or more of your plugins.
How to Solve Plugin Interference With the WordPress Login
The first thing you need to do is confirm that the issue is being caused by a plugin. You can do this by deactivating all of your plugins, or by temporarily renaming the plugins folder.
If you have access to your admin panel, simply go to the Plugins menu and deactivate all plugins. Make sure to back up your site first. Select all of the plugins, go to Bulk Actions and choose Deactivate.
If you don’t have access to the admin panel, you can rename the plugins folder in your WordPress root directory. Use a File Transfer Protocol (FTP) client, locate the wp-content/plugins folder, and rename it temporarily:
After you rename that folder, WordPress won’t be able to recognize or access it. That means it will automatically disable all plugins on your website. Although that might wreak a little havoc, it’s the fastest way to confirm if a plugin is behind your login issues.
Once you have deactivated all plugins, try logging in. If you’re now able to log in, you’ve confirmed that a plugin is causing the issue. If so, you’ll need to troubleshoot to discover which plugin is causing the issue. You can take a look at the “Check Your Plugins” section in this blog post for more detailed instructions.
4. Theme Interference
Theme problems can cause WordPress login issues, especially if your theme includes a custom login page. This issue is most likely to rear its head when a problematic theme update is installed, or when the WordPress core is updated, producing a theme incompatibility.
How to Solve Theme Interference With the WordPress Login
Determining if your theme is behind your login woes works much the same as with plugins. You can change the name of the folder for your active theme via FTP, and WordPress will revert to its default template.
To do this, temporarily rename your active theme’s directory so that WordPress doesn’t recognize it. Access the wp-content/themes folder using an FTP client, find the active theme’s folder, and give it a new name:
Now try logging in to confirm that the theme is the issue. If your active theme was behind your login problems, you might need to temporarily switch templates or disable your custom login page (if you’re using one).
5. Corrupted Login File
By default, your WordPress login page is located at wp-login.php, which is also the name of its corresponding file. If WordPress can’t find that file, then you won’t be able to log in to your website and you may run into a 404 error.
How to Restore a WordPress Login File
To determine if this is the problem (and to simultaneously resolve it) you will need to replace the wp-login.php file with a brand new one. To do so:
- Back up WordPress before deleting your login file.
- Locate your wp-login.php file within the WordPress root directory.
- Next, download the latest version of WordPress and locate the wp-login.php file in the new download.
- Copy this file in place of your deleted file.
- Open the new login file and search for “redefining user_login.”
- Just below a PHP comment beginning with that phrase, find and replace code as shown in the snippet below.
// Delete this line $user_login = $user_data["user_login"]; // Replace it with this line $user_login = $user_data->user_login;
If a corrupted wp-login.php file was the cause of your login problems, that should be fixed now!
6. Redirected WordPress or Site URL
The WordPress address URL identifies the location where WordPress is installed, while the site address URL identifies where your website should resolve. If either is wrong, it can result in WordPress login issues and other errors that prevent you from accessing the admin section.
This can happen if you have recently migrated your website or altered the location of the WordPress core files. It can also simply be due to an errant keystroke while working with your WordPress database (it happens to the best of us!).
How to Fix an Error With Your WordPress Address URL
There are lots of potential solutions when it comes to fixing the WordPress address and site address URLs. However, there is a simple (albeit temporary) trick to enable you to confirm that you do in fact have a URL issue on your hands.
After backing up your site, access the wp-config.php file within your root directory and add the following code:
define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com');
Make sure to use the WordPress address URL for WP_HOME
and the site address URL for WP_SITEURL
. By default, both addresses will be the same. However, if you’ve given WordPress its own directory, the WordPress address URL will include the directory in which you’ve installed WordPress.
Next, save the updated wp-config.php file and upload it to your server. It should overwrite the existing wp-config.php file within your WordPress root directory. Try logging in now and if you can, then you know what the cause of your problems was.
Keep in mind that this is a temporary fix, though. If you use this method, it will hard-code the values into your website and prevent you from changing them through your WordPress Settings page.
Instead, the WordPress codex recommends that you follow one of these approaches for updating your site’s URL:
- Edit your functions.php file.
- Change the URL through your database.
- Use WordPress’ “relocate” function.
You can find instructions for how to execute all three approaches within the Codex. Before you get to work, though, return your wp-config.php file to its previous state by deleting the two lines that you added to it.
7. Corrupted .htaccess File
.htaccess files include server configuration instructions and configurations for multiple or single directories. WordPress comes with a .htaccess file that you can modify to implement redirects, whitelist IP addresses, and more. However, one problem with modifying your .htaccess file is that it can become corrupted and lead to WordPress login issues.
How to Fix a Corrupted .htaccess File
The easiest way to fix a corrupted .htaccess file is to replace the version on your server with a clean copy. Here’s the default code that a WordPress .htaccess file usually includes:
# BEGIN WordPress RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress
What you need to do is access your WordPress root directory and find the .htaccess file within. Download it to your computer just in case, and then edit the file on your server. Replace its code with the snippet that you see above and save the changes to it.
It’s important to understand that doing this might affect part of your site’s functionality if you’ve made any modifications to the .htaccess file. Some web hosts also implement modifications for you out of the box for better performance.
Once you have a “clean” .htaccess file, try logging into your website again and the issue should be resolved.
Conclusion
Having WordPress login issues can be the source of much frustration and result in countless hours of troubleshooting. That’s why it is always a good idea to have a backup plugin that generates automated backups of your site that you can fall back. Nonetheless, there are lots of potential causes of login problems, so it can be difficult to know where to start.
Let’s quickly recap the solutions to run through if you’re having issues:
- Change your password.
- Clear your browser cache and cookies.
- Deactivate your plugins.
- Revert back to the default theme.
- Replace your login file.
- Define the WordPress and site URLs.
- Fix a corrupted .htaccess file.
How many of these issues have you come across while working on your WordPress site(s)? Let us know in the comments section, and don’t forget to subscribe so you can follow the conversation!
Featured image by BarsRsind / shutterstock.com
I had an issue with the recaptcha and had problems to login. Solved!
Thanks for the article! But the only file where I can find “redefining user_login” (and I’m pretty the period within quotes in your article is a grammatical period, not something in the code file) is in user.php. Nowhere in wp-login.php. I downloaded WordPress 5.7 (our site is up to date) and did a full search on all the files. In fact, user.php is the only place in the entire code base that contains the word Redefining.
And even in user.php, the following line of code is
$user_login = $user_data->user_login;
not
$user_login = $user_data[“user_login”];
as you have in your article. Which seems to make the change you suggest invalid? Besides, the full comment is
// Redefining user_login ensures we return the right case in the email.
which seems to be about email sending an email, not logging in.
What am I not understanding? We have a serious problem with not being able to log into our WP site at the moment. Your article was timely, but nothing seems to work for us.
Thanks!
Hi Don! Thanks for catching that period – you’re right, it should be outside the quotation marks. Additionally, it seems the formatting of the code snippet was distorted, so apologies if that caused any confusion.
The instruction should read that if you see this line:
$user_login = $user_data[“user_login”];
You should replace it with this instead:
$user_login = $user_data->user_login;
This solution comes right from the WordPress Codex (https://wordpress.org/support/article/login-trouble/#new-login-file).
Sorry to hear you’re having trouble with your site. Unfortunately, we can’t provide individualized support in the blog comments. If you’ve tried several solutions on your own and haven’t made any headway, I’d suggest reaching out to your hosting provider if you haven’t done so already. There are also some WordPress maintenance agencies that offer emergency support.