Back to Blog
DevOps

Disable a WordPress Plugin from the Database

Every WordPress administrator has been there -- you install or update a plugin and suddenly your site is broken. The admin dashboard is inaccessible, you're staring at a white screen of death, and you need to get things back to normal fast. The solution? Disable the offending plugin directly from the database.

When Do You Need This?

There are several scenarios where disabling a plugin from the database becomes necessary:

  • A plugin update breaks your site and you can't access wp-admin
  • A plugin conflict causes a fatal error or white screen of death
  • You're locked out of the WordPress admin panel
  • A security plugin is blocking your access

Connect to Your Database

First, you need access to your WordPress database. You can use any MySQL client, phpMyAdmin, or the MySQL command line. If you're running on AWS, you can connect via the RDS endpoint or SSH into your server and use the local MySQL client:

``bash mysql -u your_db_user -p -h your_db_host your_db_name ``

Your database credentials can be found in wp-config.php:

``php define('DB_NAME', 'your_db_name'); define('DB_USER', 'your_db_user'); define('DB_PASSWORD', 'your_db_password'); define('DB_HOST', 'your_db_host'); ``

Find the Active Plugins

WordPress stores active plugins as a serialized PHP array in the wp_options table. Query it with:

``sql SELECT option_value FROM wp_options WHERE option_name = 'active_plugins'; ``

This will return something like:

`` a:3:{i:0;s:19:"akismet/akismet.php";i:1;s:33:"problematic-plugin/plugin-main.php";i:2;s:24:"classic-editor/classic-editor.php";} ``

This is a serialized PHP array listing all active plugins.

Disable All Plugins

The quickest way to regain access is to disable all plugins at once:

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

This sets the active plugins list to an empty array. All plugins will be deactivated, and you should be able to access your admin dashboard again.

Disable a Specific Plugin

If you know which plugin is causing the issue and want to keep the others active, you'll need to edit the serialized array carefully. The safest approach is to:

  • . Copy the serialized string to a text editor
  • . Remove the problematic plugin entry
  • . Update the array count and re-index the remaining entries
  • . Update the database with the modified string

For example, to remove problematic-plugin/plugin-main.php from the array above, the updated value would be:

``sql UPDATE wp_options SET option_value = 'a:2:{i:0;s:19:"akismet/akismet.php";i:1;s:24:"classic-editor/classic-editor.php";}' WHERE option_name = 'active_plugins'; ``

Note how the array count changed from a:3 to a:2 and the indices were adjusted.

After Disabling

Once you've regained access to your WordPress dashboard:

  • . Navigate to the Plugins page -- you'll see the disabled plugins listed as inactive
  • . Re-activate plugins one by one to identify which one was causing the issue
  • . If a specific plugin was the culprit, check for updates or contact the plugin developer
  • . Consider keeping a backup of your database before activating new plugins

Prevention

To avoid getting locked out in the future:

  • **Always backup before updating** -- both files and database
  • **Use a staging environment** -- test plugin updates before applying them to production
  • **Keep plugins minimal** -- only install what you truly need
  • **Monitor your site** -- set up uptime monitoring to catch issues early

This database-level approach is a lifesaver when you're locked out, but it's always better to have proper backup and staging procedures in place to prevent these situations altogether.

Need help building this?

We help enterprises implement production AI systems.