There are situations when you can get locked out of the WordPress dashboard. There are several reasons why this happens, and most of them have different solutions. Some of the reasons that may lead to a person being locked out of WordPress dashboard are :
- Your username and password not working as well as the recovery method. This might be caused by forgetting the username and/or the password or someone hacking your website and changing the login credentials.
- You can also be locked out of the WordPress dashboard after attempting to log in with the wrong credentials many times. This is an excellent way to block hackers who use software to try and get your login credentials.
- The dreaded white screen of death. This happens when you see a blank white screen when you visit your website. This can be caused by several issues among them a problem with one or many plugins.
- A PHP parse error. This can happen when you alter the website’s code and forget something as small as a semi colon. You can edit a plugin code or a theme code and forget something. This might lead to issues accessing the WordPress dashboard.
- Installing incompatible or corrupt themes and plugins.
In this tutorial, we are going to focus on being locked out of the WordPress dashboard due to an issue with a plugin. We are going to discuss ways through which you can deactivate a plugin that blocks your access to the dashboard. There are three ways through which you can do that. They are;
- Using an FTP client.
- Through the CPanel file system.
- Through the website’s database via CPanel and phpMyAdmin.
Using an FTP Client
To explain how to deactivate a plugin using an FTP client, I am going to install the Gutenberg plugin, which is a new WordPress editor. This is the plugin I am going to disable/deactivate. I am also going to install an FTP client. There are many FTP clients that you can use, among them Filezilla and WinSCP. I will be using WinSCP for this tutorial.
I am assuming that you are going through this tutorial because you do not have access to your WordPress dashboard. Therefore, I will not talk about how you can install a WordPress plugin. But if you would like to learn how to do so, you can check this tutorial. After installing an FTP client of your choice, follow these steps to deactivate a plugin that is blocking your access to the admin dashboard;
- Launch your FTP client. This will ask you for your hostname, username, and the password to login to the server. Enter the correct credentials then click on the Login button.
- You will be logged into the host. WinSCP shows your local location on one side and the remote location on the other side. We only need the remote location for this tutorial. At the remote location window, we will need to navigate to the Plugins folder which can be found at wp-content > plugins.
- Here, we have a list of all the plugins that we have installed, among them the Gutenberg plugin that we would like to disable or deactivate. To do that, we are going to rename the gutenberg folder to gutenberg_old.
- After renaming the Gutenberg plugin folder, we are now going to try again to login to the website dashboard. If this is the plugin that had blocked access to the dashboard, you will be able to log in now.
- After you successfully log in, check your installed plugins by clicking on Plugins on the admin dashboard and you will realize that the Gutenberg plugin in my case has been deactivated.
Through the CPanel File System
You can also deactivate a plugin through your hosts CPanel. I am going to reactivate the Gutenberg plugin then deactivate it by logging into the CPanel. If I just click on the activate button on the admin dashboard, the plugin will adopt the new name we gave it above. I am therefore going to rename it to its original name, activate it and then proceed with deactivating it through the CPanel. To deactivate a plugin through the CPanel, follow the following steps;
- The first step is to log into the CPanel. You will need to have your username and password to do this. You can contact your hosting provider if you do not have them.
- Once you are logged in, navigate to the files section then click on the file manager.
- From the file manager, navigate to the root directory that has your website files. I have mine located in the public_html folder as shown below.
- From here, we will navigate to the plugins folder which can be found at wp-content > plugins as shown on the screenshot below.
- Identify the plugin that you would like to deactivate or disable. In my case, I am going to deactivate the Gutenberg plugin. To deactivate the plugin, simply rename its folder. I am going to rename the gutenberg folder to gutenberg_old.
- After renaming the plugin folder, you can now try logging into the WordPress dashboard. If you visit the Plugins page to see the installed plugins, you will notice that the plugin has been deactivated.
Through the Website’s Database via CPanel and phpMyAdmin
You can also disable a plugin through the website’s database. To do that, you will need to have access to the CPanel again. I am going to re-install the Gutenberg plugin then deactivate it through the website database.
- The first step is to log in to the CPanel. Again, you will need to have the login credentials to do this.
- After logging in, go to the database section at the CPanel home and select phpMyAdmin.
- This will open phpMyAdmin in a new tab where you can see all the databases that you have on your server. Make sure that you select the right database for your website. Once you get the right one for your website, click on it.
- The database will be expanded and you can see all the tables that it has. On the menu bar at the top, there are several menu options among them SQL. Click on SQL.
- Here, we can insert SQL queries to query the active database, which is the database that we selected above. Go ahead and insert this query. You can type it in or just copy it from here.
SELECT *FROM wp_options WHERE option_name = 'active_plugins';
- Click on the Go button at the bottom right when done to run the query. This will give a result where you will be able to see all your active plugins. Click on the edit link as shown below.
- You will see an output that resembles the one below;
Figure 7 at the beginning represents the number of active plugins that I have installed on my WordPress website. The plugins are numbered, from i:0 to i:6 in my case.
- To deactivate the Gutenberg plugin, I am going to delete its corresponding line from the output above. After deleting the line, I am going to update the rest of the output to have a total of six active plugins and change the plugin numbering as well. Here is what I am going to have;
- Click on the Go button at the bottom when done. If you try to log into the WordPress dashboard, you should be able to get through. If not, then you deactivate the wrong plugin. If you visited the plugins page from the admin dashboard, you will realize that the Gutenberg plugin has been disabled as shown below.
I know how frustrating it gets when you are not able to access your website because of a small issue such as an error with a plugin. However, it is also as simple to deactivate such a plugin and gain access to the website. In a situation where you are not sure which plugin has brought about the error, and you need to find out which one it is by deactivating it, it would be good practice to deactivate one at a time starting with the latest one to install, update or modify. This way, you will know the plugin with the errors and can easily deactivate it.