Locked Out of WordPress? Here's How to Fix the Issue
parallax background

Locked Out of WordPress? Here’s How to Fix the Issue

Oopsie! WordPress Images Not Displaying So Let’s Fix That
June 29, 2021
Fixing The “Are You Sure You Want to Do This” Error in WordPress
July 1, 2021
 

Being locked out of WordPress is a common issue that users experience. It means having no access to the website, so it’s important to fix the problem quickly.

There’s no straightforward answer to how to deal with this error. This is because it could be caused by a number of scenarios.

So it’s best to learn why people get locked out of their WordPress dashboard and what the right solution is in each case.

You don’t need to spend extra time googling all the blogs dedicated to this topic. This post presents a list of the most common reasons for the issue and how to fix the error in each case.

Following the steps below will help you regain control of your dashboard.

Locked Out of WordPress Due To Incorrect Password

 

Some people get locked out of WordPress because they forget their password.

In other cases, a login problem occurs even when users type in the correct credentials. This could mean that someone has taken control of the WordPress site and changed the login details.

If you have forgotten your password, use the "Lost Your Password" option on the login page to recover it. If that fails, here are the steps to reset the password in the WordPress database.

Solution: Resetting WordPress Password Via phpMyAdmin

 

First, connect to the Database through phpMyAdmin.

If using cPanel, sign in. Your host will be able to provide the login credentials if necessary.

Go to Databases and open phpMyAdmin.

 

On the administration page click on Structure and look for wp_users.

Next to your username select Edit. Find the user_pass field that displays the encrypted version of the current password.

 

To reset it, delete the old password and type in the new one. To encrypt it, go to the Function menu and click on MD5.

 

Finally, save the changes and go back to the login page. Try to sign in again.

The new password should allow users to regain access to the WordPress admin area.

Error Establishing Database Connection

 

Another reason people get locked out of WordPress is that it cannot connect to the database.

A WordPress site loads only if it has access to the content saved in the database stored in the wp-config file. When it tries to load the page, it sends a request to fetch the data.

For some users, the Error establishing database connection message appears. After this they may get locked out of WordPress.

The error may be a result of:

● a corrupted database

● problems with the web hosting server

● issues with the wp-config file

● server overload due to too much traffic

Solution

 

Since the problem may have different causes, the best approach is to speak to the hosting provider first. They will analyze the issue and fix it quickly.

In some cases, the hosting provider will not be able to resolve the matter from their side. They may recommend that the user fixes the database to reestablish a connection.

Login Attempts Exceeded

 

WordPress admin users often enable security plugins that limit login attempts. These plugins boost protection against malicious attacks and unauthorized access.

But sometimes the users themselves get locked out of WordPress.

Solution

It is the security plugin that blocks access to the wp admin panel after too many login attempts. Deactivating the plugin can fix the issue and return control of the WordPress site to the owner.

This is how to deactivate the plugin using FTP or SFTP:

 

First, open the folder with the WordPress files. Most of the time it's the one called public_html.

Next, find the wp-content folder and open it. Locate the plugins folder, open it and find the security plugin.

Finally, change the name of the security plugin to deactivate it.

Check if you can log in to the WordPress admin dashboard again.

Admin Privileges Denied

Some users have lost their admin privileges and their lockout is only partial. They can log in to their WordPress dashboard, but are unable to access themes and plugins.

This happens when an unauthorized person changes the administrator privileges. They often do this to take control of the WordPress website.

Solution

To solve the problem, it's necessary to add a new admin user account to the wp_users table. Then grant administrator privileges in the wp_usermeta table.

1. This is how to create a new administrator account:

 

To start, access the database via phpMyAdmin.

Find the users table. It is often called wp_users table, but sometimes it has a different prefix.

Having located the _users table, choose Insert.

 

Carefully follow the instructions below to complete the Insert form:

ID – Enter a value higher than the current number of user accounts. The list of existing user IDs are in the wp_users table.

user_login – Type in the new username you want to add. Make sure that the name is different from the existing user accounts.

user_pass – Create the password for the new account. The password needs to be hashed.

Do this by clicking on MD5 under Function. Make sure to remember the login credentials.

user_nicename – Fill out the name or nickname in the Value field.

user_email – The user email is the email address that links with the new user account.

user_url – Type your WordPress site URL in the Value field.

user_registered – Here, select the actual date on the calendar to fill out the Value.

user_status – The value should be 0 (zero).

display_name – Choose how the desired username will appear - either as a real name or a nickname.

To finish adding the new wp admin account, confirm the changes by clicking on Go.

The next step is to assign administrator privileges to the new user account.

2. This is how to grant administrator privileges to a new user account:

 

Start from the database folder in the phpMyAdmin. This time navigate to wp_usermeta and select Insert.

Again, carefully follow the instructions below to complete the Insert form:

unmeta_id – Leave this value empty.

user_id – This value is the ID number for the new user account.

meta_key – Put wp_capabilities in the Value field.

meta_value – In the Value field type: a:1:{s:13:"administrator";b:1;}

It’s best not to copy and paste the value. The quotes may change, making the value invalid.

To finish granting administrator privileges to the new wp admin account, confirm the changes by clicking on Go.

 

Finally, create an additional meta value in the wp_usermeta table. Follow the same process, but this time insert the following details in the form:

unmeta_id – Leave this empty again.

user_id – Type in the ID number for the new user account.

meta_key – This time, in the Value field type wp_user_level.

meta_value – This time, set the value to 10.

Now, confirm the changes by clicking on Go.

This process ensures that the new user account has complete administrator privileges.

Try to sign in to the WordPress dashboard and check if you have access to all the admin functions.

Getting the White Screen of Death Error

 

The White Screen of Death is not an uncommon error that can lead to being locked out of Wordpress.

When users experience this technical problem, they get a white blank screen on their site. This issue sometimes affects only a certain part of the website.

To add to the frustration there's no message to explain where the error comes from. But there are a number of solutions available.

Solution

The solution involves looking for the source of the error. It includes checking your email inbox for any alerts, disabling the plugins, clearing the cache, and modifying the memory limit.

1. Receiving an email alert

 

When users get the White Screen of Death error, the web hosting service provider sends an email informing them about the issue. The message usually includes a link to the recovery mode of the WordPress website.

So, the first thing to do is check the inbox of your WordPress admin email account.

2. Disabling plugins

 

A corrupted plugin can be another cause of the White Screen of Death error. Disabling all plugins and trying to access the site again will show if this is the cause.

To disable the plugins all at once, connect to the FTP server. Locate the plugins folder and rename it.

This step will deactivate all the plugins you're using.

Next, check if the error has disappeared. If there is no problem accessing the site, it’s clear that one of the plugins is faulty.

To find the corrupted plugin, navigate back to the plugins folder and revert the name to the original. Then go to the wp admin dashboard and reactivate the plugins one by one until the error reoccurs.

3. Clearing the Browser Cache

 

This step can also resolve the problem, unless there is a caching plugin active.

4. Changing the Site's Memory Limit

 

Increasing the memory limit is another way to find the source of the error, in this case, low server memory.

Getting the Parse Error: Syntax Error Message

 

Finally, a PHP parse error can also lead to being locked out of WordPress.

Users sometimes run into a parse error when they add a code snippet to their WordPress files. The code may be corrupted, or they didn't copy it correctly.

Solution

 

If you've copied and pasted a line of code into your WordPress files and got the parse error: syntax error message, it’s vital to revert the changes made.

To do that, connect to your site via the FTP program.

Locate the file where you posted the code, probably the functions.php file.

Delete the added code and upload the file again. It should now be possible to log in to WordPress.

Ending thoughts on being locked out of WordPress

This article presented a list of the most common reasons why people get locked out of WordPress.

Sometimes users need to reset their WordPress password. Other times, a security plugin denies them access after too many login attempts.

Or there could be a database connection error. Other scenarios include lost admin privileges, the White Screen of Death, or a syntax error.

The right solution will depend on the root cause. In any case, following the processes outlined in this post should help you regain access to your WordPress.

If you enjoyed reading this article on locked out of WordPress, you should check out this one about WordPress add media button not working error.

We also wrote about a few related subjects like failed to open stream error, WordPress post missed schedule, failed to load resource error, WordPress posting to Facebook done automatically, Wordpress mixed content errors, how to reorder pages in WordPress and WordPress updating failed error.

Albert Ślusarczyk
Albert Ślusarczyk
As the co-creator of Be Theme, I am a strong believer in designing with care and patience. I pour my energy, time & knowledge into perfecting the theme for our 230,000+ customers.