The Inconvenience of WordPress Admin Lockouts

Updated November 15th, 2017
Updated November 15th, 2017
Share this post:
Share on facebook
Share on twitter
Share on reddit
Share on linkedin
Share on pinterest
Share on digg
Share on stumbleupon
Share on pocket
Share on email
Share on print

The WordPress Admin (wp-admin) or the Dashboard is the heart of a WordPress website. Being locked out of it is annoying, especially when you need to urgently post or customize your page. Read through to learn the reasons behind the WordPress admin lockouts and what to do in each case.

The WHYs and HOW TOs

Here are some possible causes of a wp-admin lockout and their solutions:

PHP Errors

WordPress pages are written in PHP codes. If you want to alter your page layout or themes, you edit the PHP codes. Usually the theme editor, WordPress’s built-in editor, contains the themes/child theme files that you can edit. However, if you are not much of a coder, you are most likely going to copy ready-made codes from other websites. When you copy and paste, WordPress can lock you out due to syntax errors or some problems in the code. The simplest way to overcome this issue is to use FTP clients. They allow you to effortlessly copy and move files between computers on the Internet.

  • Download a FTP client like FileZilla, SmartFTP or WinSCP.
  • Identify the last file that you modified before the lockout. Delete it.
  • Upload the same file through your FTP client.

The usage of a FTP client roots out any PHP error lockouts.

Password Problems

There are instances when you enter the correct username and password, but you just cannot login. The worst case scenario is that you are not able to reset the password as well. It is most likely that your site is being hacked and you are losing vital data.

Now, every WordPress site is linked to a MySQL database that can be accessed through phpMyAdmin (a tool that allows you to create, edit and manage databases). You can change your password manually through phpMyAdmin.

  • Download phpMyAdmin from their website or use CPanel that comes with pre-installed phyMyAdmin.
  • Once installed, open and select your database.
  • Click the wp_users table from the list of tables displayed on the left of the screen.
  • Click the Browse tab, identify your user name and click the Edit icon.
  • Your password is the string of characters in the user_pass This format is MD5 hash and you need a MD5 generator as WordPress stores plain text in MD5 hash format. Use free online MD5 generators; copy and paste the hashed text in the user_pass field and click Go.

Another way to reset your password is through FTP client.

  1. Open your FTP client.
  2. Download the functions.php file from “…/wp-content/themes/YourActiveTheme/”
  3. Open the file. Add the following code below the very first <?php

wp_set_password (‘newpwd’, 1); where newpwd is replaced with a fresh password.

  1. Close the edited file and upload it on FTP.

You have now generated a new password!

The White Screen of Death

This kind of wp-admin lockout is common. You notice a blank white screen on your wp-admin page but every other WordPress feature works just fine. A malfunctioning plugin or a bad theme is a possible cause. To get out of this mess, you can try either of these two options:

  • Disable all plugins by deactivating each plugin (through FTP or phpMyAdmin) and reactivating them one-by-one. This way you can find the rogue plugin.
  • Replace your latest WordPress theme with the default WordPress Twenty Fourteen Theme.

Errors due to Databases

A corrupt database or incorrect login credentials or an unresponsive database server can lead to wp-admin lockout. This is when you get the error establishing a database connection error and your website goes down.

If facing such an issue, go through these steps:

  1. If you access wp-admin and get this error message: “One or more databases are unavailable. The database may need to be repaired”, then your database is corrupt.

To remedy this, open wp-config.php file and insert this line at the very end:

define (‘WP_ALLOW_REPAIR’, true);

Navigate to …/wp-admin/maint/repair.php. Click either Repair Database or Repair and Optimize Database. Once done, reopen wp-config.php and delete the above code. This prevents any hacker to access the Repair page.

  1. If still locked out, then reopen wp_config.php file and scroll to your login credentials: check the values for DB_NAME, DB_USER, DB_PASSWORD, DB_HOST. If any value is incorrect, change.
  1. If the above two do not work out, then it is most likely that the server is heavily loaded and is thereby unresponsive. To check if your server is running ok, simply try opening other sites. If slow, then it is most likely a server error. In that case, contact your web hosting company.

If the other sites connect well, then you should proceed to check if your login credentials are valid. This can be done in two ways. First, create a new file, say “connectiontest.php” in your WordPress directory and use the following code:

Once done, navigate to where the connectiontest.php file exists in your WordPress directory. Either you will get the ‘Your database connection is good enough’ or the ‘Unable to connect’ message.

If you get the good message, your credentials are correct.  Secondly, if you get the error message, recheck wp_config.php file as in step 2.

If none of the above works for database errors, it is imperative that you call your web hosting company.

In conclusion

WordPress admin lockouts are very annoying, especially if you were in the middle of an important task and you might lose what you were doing. You need to deal with it quickly and apply the steps stated in the article. For more clarity and information on wp-admin lockouts, refer to the official WordPress website.

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

Do NOT follow this link or you will be banned from the site!