You try to access your WordPress admin 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 (or, rather, anything) 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 what 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 admin 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.
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. 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.
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.
- 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.
- 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.
- 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.
- 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.
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.
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_ is the default WordPress prefix. It could be different if you specified that during WordPress installation.
You can edit the password under the Edit tab. 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 Go when 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
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.
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.
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 Save and 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 Insert tab. Fill in the boxes named
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 Go to apply the changes. Copy your new ID (you can now see it in the
Go to the Insert tab. 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:
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.
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:
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.
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).
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”:
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.
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.