Home / Articles / WordPress / Possible Reasons For Being Locked out of Your WP-Admin

Possible Reasons For Being Locked out of Your WP-Admin

It may suddenly happen that one day that you find that you cannot access your WordPress site. There may be no apparent reason. Yes, while this is bound to upset you a lot, there is no real cause for panic. It is possible to identify the root cause of the problem and resolve it.

There may be a couple of reasons why you've been locked out from your site's administrative panel.

  • Error Establishing Database Connection
  • White Screen of Death
  • Incorrect Password Issue

Let's take a look at each of these and the possible solutions for the same.

You can attempt to resolve all three issues, but first you need to make sure that you have a backup of all the files. In case something goes wrong, you'll be able to turn back the clock!

Error Establishing Database Connection

This message will appear when there is a possible corruption in the database or the login credentials for your database may be wrong and the unlikely scenario where your hosting service is down.

First check the error message. If it reads, “One or more database tables are unavailable. The database may need to be repaired”, then all that is required is a simple repair of the database. There are two ways you can repair your WP database.

Find your wp-config.php file and add the following add to the end.

 define( 'WP_ALLOW_REPAIR', true );

Now go to www.yoursite.com/wp-admin/maint/repair.php and follow up with the repair process. This should work, but if it fails, you can also repair your database via your phpMyAdmin module. If you'd like a further explanation head over to maketecheasier's article on solving WordPress database corruption.

On the other hand, if your site displays “Error establishing database connection”, you should identify the wp-config file, open the file and check it for any changes. This file contains the connection details of your database. There may be problems with your username and password credentials that need to be set right. Learn about these credentials and ensure that they are correct.

If the error continues even after this, the problem most likely lies with the host server. You need to check out if the MySQL server is responsive. If you know that other users of the same web hosting services are experiencing the problem, then you can be fairly certain that it is a MySQL server issue. If there is an error in testconnection.php results or while connecting to your phpMyAdmin, contact your host server to get it fixed.

White Screen of Death

As the name suggests, all that you get to see when you try to login is an unblinking blank white screen also commonly referred to by WordPress community “WordPress White Screen Of Death”. One reason for this may simply be that there is not enough space on the server. This may often be the case when hosting is shared. Clearing your browser cache or your caching plugin (if you can access it) may help.

Sometimes, the WordPress files or the database may be corrupted due to malware or other such issues, in which case it can be resolved only at the server end. Or else the server may be experiencing downtime, planned or unplanned.

The DE_BUG in WordPress can also help to identify the cause for the error. Often, it is poor coding in the theme itself or in the plugins being used that is the cause. If there has been any recent addition or modification of a plugin, the change may be undone to see if access is restored. But if you still have the white screen in front of you, it will be necessary to employ a file transfer client to make the required changes.

Plugins that are current and are actively supported by the developer as well as compatible with the latest versions of WordPress will not cause a problem. Out-of-date plugins are often the culprits.

To make sure that it is a plugin causing the problem:

  1. You can go to the wp-content folder on your website server, locate the plugins folder and rename it.
  2. All the plugins will be deactivated and if you can now gain access to your WordPress dashboard, you know for sure that the problem is with any one or more of the plugins.
  3. You can pinpoint the troublemaker by activating the plugins one by one and checking if the white screen reappears. You can then delete the troublesome plugin.

If after doing all this, you are still staring at a blank screen, then you can repeat the process done with the plugins on the themes and check out if they are working just fine.

Sometimes, the white screen may occur when you are working on the theme's functions.php file or any other WordPress php file. In this case, flawed coding is the most likely cause for the blank screen. You will then have to access WordPress using FTP and set right the defective coding.

To avoid this particular problem, some recommend that child themes be used while making changes to theme PHP. It is also best to save a live, working version of the original PHP on any third party storage before attempting to make any changes. There would be no loss of original code, in case of any goof up.

For a more detailed study of the causes for the white screen of death, I'd recommend you read Corey McKrill's article on The Theme Foundry.

Incorrect Password Problem

Sometimes, in spite of using the right username and password combination, you cannot gain access to your WordPress dashboard. Even your attempt to gain entry using the “forgot password” option does not work as you may not receive an email with the correct password. This may happen if some hacker has managed to breach your website.

The simplest solution to this would be from your hosting account. Use phpMyAdmin, open the database and identify the users. Once you do, you can change the password credentials and you are set! SiteGround has provided a quite extensive tutorial on the same and so will any good hosting service.

Final Thoughts

I hope this guide has proven useful in maneuvering your WordPress sites out of slightly tricky situations. And finally, I'd like to add despite the growth of WordPress as Content Management System and the development of excellent hardware, there is always the chance something may go wrong. So please be sure to create a backup your websites at regular intervals of time.

Also you should know that none of these problems may be plaguing your website. If that is the case and you're still locked out, please contact your web host.

Photo of author

Article by Vishnu

Keep Reading