Skip to content

How to deactivate WordPress plugins when you are locked out of the dashboard

You can switch plugins off without the dashboard. Use the recovery link WordPress emailed you, WP-CLI, a renamed plugin folder or, last, the list of active plugins in the database. Each keeps the plugins' settings. Then log in and activate them one at a time.

By
WP Ministry
Updated
Tested on
WordPress 7.1.3, PHP 8.3.35

In short

  • Use the least invasive way open to you. The recovery link first, then WP-CLI, then one plugin's folder, then the whole plugins folder, then the database.
  • Switching one plugin off keeps the rest of the site working. Switch them all off only when you cannot tell which one failed.
  • Renaming a folder stops the plugin loading. WordPress records it as deactivated when you next open the Plugins screen.
  • A plugin deactivated this way keeps its settings. Renaming the folder back does not activate it again.
  • Must-use plugins and drop-ins are not on the list of active plugins. They are switched off by moving or renaming their files.
  • A wrong password or a login page that reloads is not fixed by switching plugins off.

You can switch WordPress plugins off without the dashboard. WordPress keeps a list of its active plugins in the database and loads each one from a folder on the server. Both can be reached from outside: through a link WordPress emails you, the command line, the file manager or the database.

Use the least invasive way that is open to you. If you know which plugin broke the site, switch off that one and leave the rest running. Switch them all off only when you cannot tell. Nothing on this page deletes a plugin or its settings.

Which way to use

The ways are in order, least invasive first.

WayWhat you needWhat it switches off
The recovery linkThe email WordPress sentThe one plugin or theme that failed
WP-CLISSH access to a server with WP-CLIOne plugin, or all of them
Rename one plugin's folderThe host's file manager or SFTPOne plugin
Rename the plugins folderThe host's file manager or SFTPEvery plugin
The databasephpMyAdmin or another database toolEvery plugin

If the screen says "There has been a critical error on this website", how to fix the white screen of death explains the error and how to read the log that names the plugin at fault.

When to use it: WordPress emailed you. When a plugin or theme stops the site with a fatal error, WordPress sends a message with the subject "Your Site is Experiencing a Technical Issue". It names the plugin or theme and holds a link.

  1. Step 1: Follow the link and log in

    The link opens the login page. Log in as usual. A notice in the dashboard begins "You are in recovery mode."

  2. Step 2: Deactivate the paused plugin

    Open the Plugins screen. The plugin that failed carries the note "This plugin failed to load properly and is paused during recovery mode." Select Deactivate under its name.

  3. Step 3: Leave recovery mode

    Select "Exit Recovery Mode" in the toolbar, then load the site in a private window.

What you should see: the site loads for everyone. Until you deactivate the plugin, it is paused only for you, and visitors still see the error.

To undo it: activate the plugin again on the Plugins screen. If the fault is still in it, the site will fail again.

If the email did not arrive

  • It went to another address. The message goes to the site's administrator address, which may be an old one or a developer's. A site can also send it elsewhere, with the RECOVERY_MODE_EMAIL constant in wp-config.php.
  • The site cannot send mail. How to fix WordPress not sending email covers that, but you need to get in first.
  • The error has only shown on public pages. WordPress sends the email when the error occurs on the login page or in the dashboard. Open https://example.com/wp-admin/, with your own domain, then check the inbox and the spam folder.
  • One was sent within the last day. By default WordPress sends one such email a day, and the link in it works for a day.
  • The failing code is not an ordinary plugin or theme. Recovery mode does not cover must-use plugins, drop-ins or, on a multisite network, plugins activated for the whole network.

In any of these cases, use one of the ways below.

Use WP-CLI

When to use it: you can log in to the server over SSH and WP-CLI is installed. Your host can tell you. Run the commands from the folder that holds wp-config.php, or add --path= with that folder.

First print the active plugins and keep the list, so that you can put the site back as it was.

bash
wp plugin list --status=active --field=name --skip-plugins --skip-themes

--skip-plugins and --skip-themes stop WP-CLI from loading the plugins and the theme while it runs. Without them, the broken plugin would stop the command too.

To switch off one plugin, use its folder's name:

bash
wp plugin deactivate plugin-folder-name --skip-plugins --skip-themes

To switch off all of them:

bash
wp plugin deactivate --all --skip-plugins --skip-themes

What you should see: a line such as Plugin 'plugin-folder-name' deactivated. for each plugin, then a line that begins Success:. Reload the site.

To undo it: wp plugin activate plugin-folder-name.

Must-use plugins are still loaded even with --skip-plugins. If the command itself stops with a PHP error, look at those (see below). On a multisite network, add --network for a plugin that is active for the whole network, and --url= to name one site.

Rename one plugin's folder

When to use it: you know which plugin failed. It was the one you had just installed or updated, or the error log names its folder.

  1. Step 1: Open wp-content/plugins

    Use your host's file manager or an SFTP program. Each plugin has a folder of its own.

  2. Step 2: Rename the plugin's folder

    Add -off to the name, so that plugin-folder-name becomes plugin-folder-name-off. Do not delete it.

  3. Step 3: Reload the site

    It loads without that plugin. WordPress skips an active plugin whose file is not where it expects it.

  4. Step 4: Log in and open the Plugins screen

    This step matters. WordPress checks its list of active plugins when this screen opens. It shows a notice that the plugin "has been deactivated due to an error: Plugin file does not exist." and takes it off the list.

  5. Step 5: Rename the folder back when you are ready

    The plugin appears on the Plugins screen as inactive, with its settings kept.

What renaming does and does not do. Until you open the Plugins screen, the plugin is only missing. It is still on the list of active plugins. Rename the folder back at that point and it runs again, fault included. Once the screen has recorded it as deactivated, renaming the folder back does not activate it.

To undo it: rename the folder back and select Activate under the plugin's name.

Rename the whole plugins folder

When to use it: you cannot tell which plugin failed and you have no WP-CLI.

  1. Step 1: Rename the folder

    In wp-content, rename plugins to plugins.hold.

  2. Step 2: Log in and open the Plugins screen

    Go to https://example.com/wp-admin/plugins.php, with your own domain. WordPress finds no plugin files, reports each plugin as missing and records them all as deactivated.

  3. Step 3: Rename the folder back

    Change plugins.hold back to plugins.

What you should see: every plugin is listed again and every one is inactive. Their settings are kept.

To undo it: activate the plugins on the Plugins screen, one at a time, as described below.

Empty the list in the database

When to use it: last, when you have no file access and no command line, only a database tool such as phpMyAdmin in your host's control panel.

  1. Step 1: Find the options table

    Its name is the table prefix followed by options. The prefix is set by $table_prefix in wp-config.php and is wp_ by default, which makes the table wp_options.

  2. Step 2: Find the active_plugins row

    Look for the row whose option_name is active_plugins.

  3. Step 3: Save the current value

    Copy the whole of option_value into a text file. It is your record of what was active.

  4. Step 4: Replace the value

    Edit the row, set option_value to exactly this, and save:

    text
    a:0:{}

In SQL, with your own prefix in place of wp_, the same change is two lines. Save the first one's result before you run the second.

sql
SELECT option_value FROM wp_options WHERE option_name = 'active_plugins';
UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins';

What you should see: the site loads with no plugins, and the Plugins screen lists every plugin as inactive.

If nothing changes: WordPress reads its options through the object cache before it asks the database. On a site with a persistent object cache, the old list can still be held there. Empty that cache from your host's control panel, or with wp cache flush.

To undo it: paste the saved value back into the row. That turns every plugin on at once, the broken one included, so prefer activating them from the Plugins screen.

On a multisite network, plugins activated for the whole network are not in this row. They are kept as active_sitewide_plugins in the network's sitemeta table, so emptying active_plugins leaves them running. Renaming a folder works on those as well.

What none of these switches off

Two kinds of code run without being on the list of active plugins.

  • Must-use plugins are PHP files placed directly in wp-content/mu-plugins. They are always on, they load before ordinary plugins, and the dashboard cannot disable them. The Plugins screen shows them in a section of their own. To switch one off, move its file out of that folder. Ask whoever put it there before you do.
  • Drop-ins are single files in wp-content that WordPress loads by name. object-cache.php supplies an external object cache. advanced-cache.php is a caching layer that WordPress loads when WP_CACHE is true in wp-config.php. To switch one off, rename the file, for example to object-cache.php.off.

If the site still fails with every plugin off, and the error log names a file in one of those places, that file is the one to move. wp plugin list --status=must-use and wp plugin list --status=dropin list them.

Bring the plugins back one at a time

  1. Step 1: Log in and open the Plugins screen

    Every plugin you switched off is listed as inactive.

  2. Step 2: Activate one plugin

    Start with the ones the site cannot do without, such as the security plugin and the store. Activate a plugin before its add-ons.

  3. Step 3: Check the site after each

    Load a public page and a dashboard screen. If both work, go on to the next plugin.

  4. Step 4: Stop when the site breaks

    The plugin you activated last is the cause. If WordPress catches the fault as you activate it, it refuses and says "Plugin could not be activated because it triggered a fatal error", and the site stays up. If the site goes down instead, switch that plugin off again by renaming its folder.

With WP-CLI, wp plugin activate plugin-folder-name does the same, one name at a time.

Then deal with the plugin you found:

  • Update it. A fixed version may already be out. Update the plugin, then activate it.
  • Go back one version. If the fault came with an update, the version before it worked. How to safely update WordPress shows how to install it again.
  • Replace it. If the author no longer maintains the plugin, find another that does the job.

If every plugin works alone and the site fails only with certain ones together, you have a conflict. How to find and fix a WordPress plugin conflict shows how to find the pair and report it to the authors.

When the cause is not a plugin

The theme. The same ways apply. The recovery link pauses a failing theme as it does a plugin. With WP-CLI, list the installed themes and activate a default one, whose name begins with "twenty":

bash
wp theme list --skip-plugins --skip-themes
wp theme activate default-theme-folder-name --skip-plugins --skip-themes

Without WP-CLI, rename the active theme's folder in wp-content/themes, log in, and go to Appearance, then Themes. WordPress says "The active theme is broken. Reverting to the default theme." and switches to a default theme if one is installed. To undo it, rename the folder back and activate your theme again.

The login. If the login page loads and will not let you in, switching plugins off may not help.

Something else. If the site fails with every plugin off and a default theme active, look outside both. WordPress site down: a runbook for the first hour helps you find the layer at fault.

When to get help

Ask your host if you have no way into the files or the database, or if a must-use plugin you did not install is the file at fault. If the site is down and you would rather hand it over, an Emergency Fix is a one-time repair for a WordPress site that is down, and it begins with a free diagnosis that gives you a written cause and a fixed quote.

Common questions

Will I lose a plugin's settings?

No. Each way on this page switches a plugin off and leaves its settings in the database. Do not delete a plugin's folder to switch it off: you would then have to install the plugin again.

I renamed the folder back and the site broke again. Why?

WordPress had not yet recorded the plugin as deactivated. Renaming a folder only hides the plugin. WordPress takes it off the list of active plugins when someone opens the Plugins screen while the folder is still renamed. Rename the folder again, log in, open that screen, and then rename it back.

The recovery link has expired. Can I get another?

Yes. By default the link works for one day, and WordPress sends a new email when the error occurs again after that. Open /wp-admin/ on your site to make it happen, then check the inbox. If nothing arrives, use one of the other ways.

Can I switch plugins off for myself only, so that visitors notice nothing?

Only in recovery mode, which pauses the failing plugin for you alone. Every other way on this page changes the site for everyone. Once you are back in, the troubleshooting mode described in how to find and fix a WordPress plugin conflict tests with plugins off while visitors see the normal site.

More on this subject

Quick Fix, done for you

Quick Fix is $49. One issue, one site, up to about an hour. No fix, no fee. 30-day warranty. It starts with a free diagnosis.