WordPress Login Not Working? Fix ‘Can’t Access WP-Admin’

You try to access your WordPress Login account, but the login page just keeps refreshing? Or you see error messages instead of your dashboard?

This issue is not uncommon. Since you can’t do much to manage your WordPress site without being logged in as its admin, we want to get things back to working as they should.

The first thing to do is to identify the kind of problem you’re facing. The faces of this error are multiple. In most cases, knowing the reason helps select the suitable method to implement. We’ll outline the main types of the problem and provide the solutions depending on what you see instead of your dashboard after the login. 

WordPress login problems: Main causes

1. Incorrect login name and password

One of the potential reasons you’re deprived of access to your admin account is that WordPress doesn’t recognize your credentials. This often happens as a result of a hacker’s attack on your website. However, the mere human factor is responsible for errors even more often.

To rule out the typos and spelling mistakes, verify you’ve typed in the correct credentials. If that was not the reason, or you can’t recall or find your login and password, then you want to restore your WordPress login data from the backend.

Solution:

If you’ve lost or forgotten your password, 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. If your site is hosted on a Linux server, you will usually have access to phpMyAdmin. However, before you edit your WordPress database, create a complete backup. 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 Go.
Setting user_pass with phpMyAdmin

At this point, you should be able to login 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.

2. Restricted permissions

The login to your WordPress account was performed successfully, but the account only shows the most general, user-side information. If you lost your admin privileges, most likely, someone has gained them by hacking your site. Even though WordPress is a highly secure platform, you can find some plugins and themes with vulnerabilities, and hackers grow more and more inventive.

Solution:

We recommend you keep your site up to date in all its aspects, from plugins to the PHP version, to prevent this in the future. If this is what you’ve encountered now, you can create a new account.

3. Error establishing a database connection

In order to work, your WordPress site relies on lots of files that it keeps in a database. It runs SQL queries to gain the information necessary to process the request and load a page or post. Sometimes your website can’t access this database; it can be due to the wrong database-related credentials or some server-side problems. If the latter is the case, contact your hosting provider if they can fix it.

Another reason behind this error can be a corrupted database structure. Some poorly coded themes or plugins can impact the database, causing tables to disappear. Try to install only the trustworthy ones to avoid any conflicts. A helpful practice to keep your database healthy is to work on optimizing MySQL for WordPress regularly.

And, of course, as the name of the error implies, it could be that WordPress just cannot reach the database because of the wrong database-related credentials. Learn how to change them in a few simple steps.

4. Other problems with your website

1. White screen of death

If you see a blank screen when logging in to your account, it’s possibly the result of errors caused by your WordPress theme or plugins. Some of the rogue ones can do severe damage to your website and pose security threats (this is the right time to once again remind of the importance of choosing well-known and safe-to-use plugins and themes). Down below, we explain how to deactivate them when you’re outside your admin area, and regular login is impossible.

2. PHP errors

PHP is responsible for the structure of every WordPress site. That being said, it is no wonder even the most innocent-looking mistake in PHP leads to failures in the entire website’s operation. This is why we insist you should try to avoid editing code unless you’re a professional developer and are absolutely confident in what will happen after every step you take.

Often, the errors occur after manual editing of the theme files like functions.php. If you’ve recently made any modifications to the WordPress files, you want to consider them as potential culprits first. Learn how to monitor PHP errors on WordPress to avoid this type of scenario.

The condition that particularly often causes login problems is memory limit exhaustion. You can extend the limit in the files from your WordPress directory: in some cases, it helps with the login.

3. Internal server error

Sometimes you get the widely known internal server error, AKA error 500. Though you may find it worrisome, there are several solutions you can employ to fix it. And never worry: in any case, you can call on us to help you with any WordPress-related issue.

4. Page not found

The error 404 is another type of login error you may get. As the message states, your WordPress site or its URL wasn’t found when you attempted to log in. Below, we’ll show you what to do to fix it.

5. Cache and Cookies

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.

Solution:

Luckily, cache and cookie issues are usually easily fixed. First, check that cookies are enabled and then clear both your browser cache and cookies.

WordPress Login
WordPress Login not working

While WordPress is an incredibly powerful platform, it does come with its share of occasional frustrations. One potential source of grievance amongst 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 might occur, and offer appropriate solutions.

6. Lost or Forgotten Password

This is an obvious one, of course, but nonetheless an important 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.

Solution:

If you’ve lost or forgotten your password, 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. If your site is hosted on a Linux server, you will usually have access to phpMyAdmin. However, before you edit your WordPress database, create a complete backup. 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 Go.
Setting user_pass with phpMyAdmin

At this point, you should be able to login 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.

7. Cache and Cookies

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.

Solution:

Luckily, cache and cookie issues are usually easily fixed. First, check that cookies are enabled and then clear both your browser cache and cookies.

8. 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.

Solution:

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 select Deactivate.

If you don’t have access to the admin panel you can rename the plugins folder. Use a File Transfer Protocol (FTP) client, locate the wp-content/plugins folder, and rename it temporarily.

Folder list within the FTP server showing the renamed plugins folder

WordPress won’t recognize the folder and will deactivate all plugins.

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.

9. Theme Issues

Theme issues can cause login problems, 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.

Solution:

Determine if a theme issue is causing your login woes by reverting back to the default theme. To do this, temporarily rename your active theme’s directory so that WordPress doesn’t recognize it.

You can do this by accessing the wp-content/themes folder using an FTP client, finding the active theme’s folder, and renaming it. This will force WordPress to revert to the default theme.

Now, try logging in to confirm that the theme is the issue. Also, take a look at the “Check Your Theme” section of this post for more details.

10. Corrupted Login File

If the WordPress login file, wp-login.php, is corrupted, deleted, or misplaced, you won’t be able to access the login screen at all.

Solution:

To check if this is the problem (and to simultaneously resolve it) you will need to replace the file with a new one.

  • Backup WordPress before deleting your login file.
  • Locate your wp-login.php file with an FTP client and delete it. You’ll find it in the directory where you’ve installed WordPress.
  • 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.
010205// Delete this line$user_login = $user_data["user_login"]; // Replace it with this line$user_login = $user_data->user_login;

If the login file was the issue, you should now be good to go.

11. 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 cause all sorts of issues, including the inability to access the admin area to correct the mistake.

This can happen if you have recently migrated WordPress, altered the location of the WordPress core by moving WordPress to a subdirectory, or it can simply be due to an errant keystroke while working with your WordPress database.

Solution:

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 with an FTP client and add the following code:

0102define('WP_HOME','http://example.com');define('WP_SITEURL','http://example.com');

Making 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 it’s own directory, the WordPress address URL will include the directory in which you’ve installed WordPress.

Save the updated wp-config.php file and upload the modified file to the server using your FTP client. If you can now successfully log in, then you’ve identified the problem.

However, this is a temporary fix so you should delete the added code and update the WP_HOME and WP_SITEURL values in your site’s database using another method to correct the issue permanently.

A quick check before we start

When performing any fixes, stay on the safe side and protect your website from any unwanted outcome. Remember that things can potentially go wrong even if you think you’ve done everything right. Here’s a checklist of what you need to do now and should always do before making changes to your website.

  1. Backup your site. It is simple and saves you a lot of time and nerve if you want to get things back to square one.
  2. Use a child theme for WordPress or any other staging environment to try things out before applying it to the up and running website. It is especially true if you aren’t 100% certain about what you’ll get from the modifications. A pig in a poke isn’t always a pleasant surprise.
  3. Make sure you have an FTP account and can work with it. When a normal login is an unavailable option, FTP is how you get to manage your website’s files.
  4. Test your website after every fix or adjustment. That way, it won’t take you long to find a problem if something breaks.

And on with the troubleshooting!

Login error fixes

We’ve mentioned FTP not in vain: you’ll need it for all the steps below. One thing you can do without it is to check the permissions for the cookies.

Enable cookies

Cookies are one of the most common causes of WordPress admin login problems. But WordPress requires them to work; so, you must have them enabled in your browser.

Start with deleting the browsing history. Make sure you delete the data for the All time period. You’ll also see the list of data you can clear along with the browsing history. Check cache and cookies to make everything load anew. The hotkey combination for it in the most popular browsers would be Ctrl (or Command) + Shift + Delete. After that, make sure cookies are enabled and proceed to the login page to try to enter again.

Fix the database connection error

If you get the EEDC, you can fix it by resetting the password for the database. From the backend, the way to do it is to change it in the wp-config file.

Can’t Log In As Admin On WordPress

Log in to your site using FTP. Look for wp-config.php in your WordPress root directory, download and open it.

In this file, find the lines that read:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */

Below you’ll see your WordPress database credentials.

define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

Note that we put the placeholders (in red) for the actual sensitive data you’ll be editing. Yours will look different.

Check if the data you see matches what you’ve set as credentials when creating your site. If the ones in the wp-config are incorrect, change them and check if login is performed correctly now.

Reset incorrect credentials

WordPress offers multiple ways of resetting login and password for your account. It is helpful to start with the options that are easier to perform, like restoring the data with your email: it is still possible even if you were hacked. If this strategy doesn’t show any success, try the backend access.

1. In the database

WordPress database, among other things, stores your user ID and password. To retrieve it from there, you will need to access your database using phpMyAdmin.

Find your WordPress site database. There, find the users table and click on it. It is usually named wp-users because wp_ is the default WordPress prefix. It could be different if you specified that during WordPress installation.

Can’t Log In As Admin On WordPress

You can edit the password under the Edittab. It would offer you several input fields; you’re looking for user_pass. Provide the new password in the box and select the MD5 function in the menu left from it. Don’t forget to click Gowhen you’re done.

Try to log in to your WordPress admin area again using the new password.

2. In functions.php

This is one more way to reset your password. With FTP, find your function.php file of the active theme (located in the corresponding theme folder in wp-content > themes). Open the file and add this after the first <?php tag:

wp_set_password( 'password', X );

Here, X is where you put your user ID from the wp_users table (the paragraph above describes where it resides).

3. With WP-CLI

WP-CLI is a helpful tool that lets you manage essential WordPress site information without using an internet browser. If you use this command line interface for WordPress, you can use it to fix the login error, too.

Can’t Log In As Admin On WordPress

You will need to change the password with it. Run the command:

$ wp user list

It will display the list of all users registered on this website. Find your admin account ID – copy or memorize it for the following step.

To update the password for the account you selected, you need to paste the following line:

$ wp user update X --user_pass=Y

Of course, you need to set your data in the command: put your ID for the X and the new password for the Y. By executing this command, WP-CLI will force your password to change. When you’re finished, go to the login page again and repeat the attempt with the password you’ve just set.

4. With new wp-login.php

Issues with this file can also interfere with your logging in. If there’s anything wrong with it (or you’re short of it), you need to re-upload this file.

Can’t Log In As Admin On WordPress

First of all, delete the one you have from the WordPress root directory. Then, get a new file by downloading the latest version of WordPress. Upload the new login file to your root directory and open it to edit. The modification will be tiny and almost effortless: find the line that says

$user_login = $user_data["user_login"];

Change it for

$user_login = $user_data->user_login;

Click Saveand check if you can log in now.

Create a new admin account

If you’re logged in but incapable of managing anything, it means that someone has gained unauthorized access to your site and stole your privileges.

However, you can still create a new account using phpMyAdmin. Find the wp-users table (or any table that says _users) – here’s where you can find it.

Go to the Inserttab. Fill in the boxes named user_login, user_pass (for this one, you’ll also need to select MD5 in the dropdown menu) and user_email with your data. Put the period for which the user will be registered in user_registered, and set the user_status to 0. Click Goto apply the changes. Copy your new ID (you can now see it in the users table).

Open the usermeta table.

Can’t Log In As Admin On WordPress

Go to the Inserttab. Fill in your user ID from the previous step, paste wp_capabilities in the meta_key box and set the meta_value to be this:

a:1:{s:13:"administrator";s:1:"1";}

Leave other boxes empty. Click Go, and you’re all set. Now you have a new admin account; use the credentials you’ve just created to access your dashboard.

Fix the white screen of death issue

1. Disable the theme and plugins

If you get a blank screen after the login page, the first thing you should try to do is to disable your plugins and the active theme. “But how do I do that if I have no access to my admin dashboard?” you may wonder. Here’s a trick: you can just rename the corresponding files in your WordPress folders.

Access your WordPress directory using FTP. Find the wp-content folder: both theme and plugins are located there.

Can’t Log In As Admin On WordPress

Then, rename the themes folder to make the website switch to a default theme, and do the same for the plugins folder to disable all plugins you have installed.

2. Increase memory limit

When your website’s configurations have a memory limit set too narrow, it can quickly get exhausted. It may lead to various abnormal results, one of which is admin login attempt failures. You can try to use the following trick, but note that it doesn’t always work (depending on the hosting you have)

Open the wp-config.php file to edit it and, above the line that says “That’s all, stop editing! Happy blogging”, insert this:

define('WP_MEMORY_LIMIT', '256M'))

See if you can access your account now.

Fix error 404

1. Delete .htaccess

Before deleting this file, you can troubleshoot to see if it actually is responsible for your login problem. Locate it in the WordPress root directory and rename it so that WordPress can’t find it.

Can’t Log In As Admin On WordPress

If it helps and this login attempt was successful, then you can delete it. In this case, you can create the new one from your dashboard: Go to Settings > Permalinks and click Save (yes, you don’t even have to change anything, your site will generate the new one).

Can’t Log In As Admin On WordPress

If deleting the .htaccess wasn’t particularly fruitful, you can try to re-upload the wp-admin.php file. Likewise, download the new one from the most recent WordPress files and upload it to the root directory.

2. Verify the URL

The wp-config.php file contains a lot of fundamental information about your WordPress site. Along with other things, you can use it to check if WordPress links to the correct URL even without accessing your admin area.

With your FTP client, find and open the config file. Paste this just before the line that says “That’s all, stop editing! Happy blogging”:

define('WP_HOME','https://www.yourwebsite.com');
define('WP_SITEURL','https://www.yourwebsite.com');

Substitute the URL in red with your URL. This should fix the login error if you had the wrong  URL in your WordPress admin area for some reason.

Conclusion

Hopefully, these solutions helped you restore access to your admin account. If you frequently encounter login problems or other issues with your WordPress site, consider seeking professional advice and setting up a maintenance plan.

Show Buttons
Hide Buttons