3 Easy Ways to Disable WordPress Plugins When Your Site Crashes

Posted on Updated on

Many things can cause the WordPress White Screen of Death. It’s usually related to a theme failure or a problem with a plugin. If you can access your WordPress administration dashboard, that’s great. You can disable all plugins with a single click. But what if the white screen of death shows up for all WordPress pages? What if you’ve lost access to your dashboard and need to disable every single plugin at the same time now?

Here are three (3) ways to disable all the WordPress plugins:

Method #1: Renaming the Plugins Folder

Disabling a plugin using FTP is simple. We just make it impossible for WordPress to find it. Usually, this means renaming the specific add-on. We can do this on a case by case basis, or we can go one step further and rename the entire directory! This works great as a “nuke em all” option and is usually the best way to proceed when you experience a site-wide whiteout.

Simply open up your directory via FTP using something like FireFTP for Firefox and navigate to yoursite.com/wp-content. Now just find the “plugins” folder, right click on it, and rename it to something else. In my example, I’ve chosen to call it “plugins-renamed” instead of as shown below.

plugins renamed

If you have dozens of plugins, you can save quite a bit of time compared to renaming each one individually and checking to see if the pages load or not. Here you just need to check once to try and see if the plugins are the culprit. If you’re lucky and your site becomes functional, you should see the following when you go to your plugins page:

all plugins deactivated

Re-Enabling The Plugins One by One

Now that you know that some plugin is causing the problem, there are two ways you can enable them one by one. Either rename your directory back to the original name and then start renaming each plugin folder one by one. The problem with this approach is that your site will be unavailable until you find the plugin that’s causing the problem.

The other way is to create a new empty directory called “plugins” and start transferring the folders from the old directory into the new one piece by piece as shown below:

transferring to the new directory one by one

This way, your site remains online right until you find the plugin that’s messing it up. You can then quickly copy over the rest and figure out what went wrong later. The disadvantage is that FTP takes a long time to transfer folders with lots of files and if you have a few large plugins, this process can take a while. It all depends on whether you can afford for your site to be down just a while longer. If it’s not a huge deal, go with individual renaming. If minimizing downtime is crucial, just go ahead, create a new directory and start copying them one by one.

Luckily for us, WordPress is highly modular and enabling or disabling plugins is as simple as adding and removing files. By renaming the entire directory, you can deactivate all plugins at the same time even if you don’t have access to the WordPress backend.

Method #2: Disabling Plugins via phpMyAdmin

As with all operations involving databases, you have to be very careful here lest something go wrong. It is always prudent to take a quick backup before making any changes. With that said, the database is often the quickest way to resolve many intractable problems. I had previously written about how to change the username and password of a WordPress user including the admin itself using phpMyAdmin – the open source web-based database administration program that is so incredibly useful. You can refer back to that article if you don’t know how to access the phpMyAdmin console or what the icon looks like.

In that article, we opened the “wp_users” table. In order to disable plug-ins, navigate to the “wp_options” table instead.

wp_options

This will show you all the rows in the table, but there can be thousands of them. We want the row where the “option_name” column has a specific value. To do this, we’re going to craft our very own SQL query. There will be a series of tabs at the top of the screen labeled “Browse”, “Structure” etc. Click the one called “SQL”:

wordpress plugins sql

You will now be presented with a text box with a query already inside it. Delete it, and paste this one instead:

SELECT * FROM wp_options WHERE option_name = 'active_plugins';

Click the “Go” button at the bottom right. The results will consist of exactly one row where “option_name” has the specified value of ‘active_plugins’. Click the “Edit” button at the left end of the row to bring up the edit screen:

active_plugins option_value

As you can see, the “option_value” field is the one of interest to us. The text within it specifies both the number of active plug-ins as well as their names. The very first value in the example above tells me that I have 14 plug-ins installed. If you peruse the text within the curly brackets carefully, you will see that it starts off with i:0, then the next is i:2, and so on up to i:13. It also gives us the location of the main plug-in file.

But all of this is only for interest. If you want to deactivate all the WordPress plug-ins in one go, just delete the entire entry after taking a backup of its contents by pasting it in notepad or something in case you want to revert to the earlier situation. Then paste this into the text box:

a:0:{}

Also, note that you can individually deactivate a plug-in by modifying the text. Say for example you feel that the Jetpack plug-in is causing your problems. In the example above, remove the line:

i:6;s:19:"jetpack/jetpack.php";

Now you need to change each individual “i” after that to ensure that the numbering is consecutive. In other words, “i:7” will become “i:6”, “i:8” will become “i:7” and so forth. You’ll also have to change the very first “a” value. In my case, “a:14” will become “a:13” since I will only have 13 plug-ins activated instead of 14.

Once again, don’t forget to take a backup of the original text in case you have to start over! After you’ve made your changes, hit “Go” to apply them. And magically, all of your plug-ins have been deactivated if you chose to replace the text with a:0:{} . From here, you can go to the WordPress plug-ins screen from the dashboard and enable them manually one by one until you find the one that’s causing the error. After that, it’s a simple matter of disabling it either via FTP or using phpMyAdmin once again as just described.

These two methods are powerful tools for enabling or disabling plug-ins from the backend if you’re unable to access your WordPress installation using the regular administration dashboard. Just be careful to take precautions in case something goes awry.

Method #3: Using the “Mu-Plugin” Folder to Disable all Plugins in WordPress

Not many people know, that WordPress has the possibility of having a special folder called “mu-plugins” under “wp-content”. This folder won’t be present for everyone and consists of plugins that will be run before all others. Moreover, they cannot be manipulated from within the WordPress interface. Any plugins here will show up in the plugins screen, but users cannot deactivate, delete, or edit them. They can be placed directly via FTP, and only direct access to the folder allows us to remove them.

The history of “mu-plugins” is a complicated one, and we won’t go into it here. Suffice to say that these days, MU stands for “Must Use”. It wasn’t always like that though. So here’s how to disable all plugins in one go using the mu-plugins folder.

Step 1: Create the Folder “mu-plugins” in wp-content

Not everyone has the “mu-plugins” folder in WordPress. If not, you can easily create it. Just FTP into your WordPress installation or use cPanel to navigate to the wp-content folder in your WordPress root and create an empty directory called “mu-plugins” as shown here:

Step 2: Create the Plugin File

After you’ve created the folder, create a file with the extension “.php” and paste the following code into it:

<?php

add_filter('option_active_plugins', function (){ return array(); });

Name it whatever you want and save it.

Step 3: Upload the File into mu-plugins

Next, upload this file into the mu-plugins folder we created in step 1.

Check to See if your Plugins are Disabled

And you’re done! Because this plugin runs before all others, the code within it will disable all the plugins currently active on your site. When you visit your plugin page, here is what you’ll see:

Disable all Plugins in WordPress

You can see that there’s now a new tab called “Must-Use”, and it contains the file we just uploaded. Also, note how the number of inactive plugins is equal to the total number of plugins on the site. That means we’ve just disabled everything as expected.

This is a very clean method to disable all plugins in WordPress. Another advantage is that when you delete the file, all your currently active plugins will be enabled again. No need to remember which ones were active anymore!

However, the biggest disadvantage is that you can’t troubleshoot your installation by enabling the plugins one at a time. Removing the file will simply enable everything as it was before. So you have no way to go one by one and activate each to find out which is the problematic file.

But if you want a quick and painless way to quickly and temporarily disable all plugins on your site, the mu-plugins folder is a great solution!

Leave a Reply

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