2026年11月13日
2026年11月13日
Deactivate WordPress Plugins from the Database: Edit active_plugins
This article is a localized edition of the Japanese original. Read the Japanese original
When a broken plugin locks you out of the admin, remember that the list of active plugins is stored in the database, in a value called active_plugins in the wp_options table. By changing it, you can deactivate plugins without using the admin. Everything in this article was checked against the WordPress 6.9 source code as of November 2026.
Methods to try before touching the database
Editing the database directly can cause new problems if you make a mistake. If one of the following is available to you, it is easier.
| What you have | Method |
|---|---|
| The administrator's email | Since WordPress 5.2, a fatal error sends a "recovery mode" link to the administrator's email address. If you log in through that link, you can use the admin with the problem plugin paused. |
| FTP or a file manager | Rename the problem plugin's folder inside wp-content/plugins/ (for example, plugin-name to plugin-name-off). WordPress stops loading the plugin, and it is deactivated when you open "Plugins" in the admin. |
| SSH and WP-CLI | wp plugin deactivate プラグイン名 (use the plugin's slug), or wp plugin deactivate --all for all of them |
Use the method in this article when you have neither FTP nor SSH, and only phpMyAdmin from your hosting control panel.
1. Make a backup
In phpMyAdmin, select the WordPress database and save the whole database from "Export". At the very least, save the wp_options table.
2. Check the table prefix
The wp_ in the table names is the prefix chosen at installation. One-click installers at hosting companies sometimes use a different string. Check it on this line in wp-config.php.
<?php
$table_prefix = 'wp_';
The SQL below uses wp_options, so substitute your own prefix if it differs (for example, wp8_options). You can also see it in the table list on the left side of phpMyAdmin.
3. Check the current value and save a copy
Run the following in phpMyAdmin's "SQL" tab.
SELECT option_value FROM wp_options WHERE option_name = 'active_plugins';
The result is in PHP's serialized format and looks something like this.
a:3:{i:0;s:19:"akismet/akismet.php";i:1;s:36:"contact-form-7/wp-contact-form-7.php";i:2;s:20:"broken-plugin/me.php";}
| Part | Meaning |
|---|---|
a:3:{…} |
An array with 3 elements |
i:0; |
Element number 0 |
s:19:"akismet/akismet.php"; |
A 19-byte string (the plugin's folder name and main file) |
Save this value as is in a text file so you can restore it later.
4. Deactivate all plugins
If you don't know which plugin is the problem, or you want back into the admin quickly, set the value to an empty array.
UPDATE wp_options
SET option_value = 'a:0:{}'
WHERE option_name = 'active_plugins';
Once you can get into the admin, activate plugins one at a time on the "Plugins" screen and see which one brings the problem back. When you find it, wait for an update to that plugin or look for an alternative.
5. Deactivate a single plugin
To remove just one plugin, delete its element and change the element count. Removing broken-plugin/me.php from the example above gives this:
UPDATE wp_options
SET option_value = 'a:2:{i:0;s:19:"akismet/akismet.php";i:1;s:36:"contact-form-7/wp-contact-form-7.php";}'
WHERE option_name = 'active_plugins';
Rules for editing:
- Change the leading
a:3to the number of remaining elements (here,a:2). - The number after
s:is the string's length in bytes. If it is off by even one character, the whole value can no longer be read. Copy the elements you keep exactly from the original value. - The index numbers (
i:0;and so on) still work with gaps, but renumbering them makes the value easier to check.
If you miscount, you may end up in the same state as having all plugins deactivated, or WordPress may be unable to read the value. If you are not confident, use step 4 and deactivate everything.
Using the MySQL command line
If you can reach the server over SSH but WP-CLI is not installed, the mysql command does the same job. Find the database name and user in DB_NAME and DB_USER in wp-config.php.
mysql -u DB_USER -p DB_NAME
SELECT option_value FROM wp_options WHERE option_name = 'active_plugins'\G
UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins';
Restoring the previous state
Re-activating plugins one at a time in the admin is the safest way, but if you have many plugins, you can also put back the value you saved in step 3.
UPDATE wp_options
SET option_value = 'paste-the-saved-value-here'
WHERE option_name = 'active_plugins';
If the restored value includes the problem plugin, the same problem comes back.
When the change has no effect
With a persistent object cache using Redis or Memcached (a setup that has wp-content/object-cache.php), option values are read from the cache, so a change in the database may not take effect. Clear the server's cache, or temporarily rename object-cache.php, and check again.
On Multisite
On Multisite, plugin status is stored in two places.
- Network-activated plugins:
active_sitewide_pluginsin thewp_sitemetatable - Plugins activated on each site:
active_pluginsin that site's options table (wp_2_optionsfor the site with ID 2)
active_sitewide_plugins is an array with the plugin file names as keys and the activation time as values, a different shape from active_plugins. To deactivate everything, set it to a:0:{} as well.
SELECT meta_value FROM wp_sitemeta WHERE meta_key = 'active_sitewide_plugins';
UPDATE wp_sitemeta SET meta_value = 'a:0:{}' WHERE meta_key = 'active_sitewide_plugins';
Related articles
- How to use WordPress recovery mode
- How to safely deactivate a WordPress plugin
- Backing up a WordPress database with phpMyAdmin
Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)