2026年11月13日
2026年11月13日
Safely Deactivate and Delete a WordPress Plugin (Admin and WP-CLI)
This article is a localized edition of the Japanese original. Read the Japanese original
The trouble with stopping a plugin is when the result does not match what you expected: the site layout breaks after you deactivate it, or its settings disappear (or stay behind) after you delete it. This article first sorts out what happens when you deactivate or delete a plugin, then walks through a safe procedure. Everything here was checked against the WordPress core and WP-CLI source code as of November 2026.
Deactivate, delete and uninstall: the differences
| Action | Plugin files | Settings and data in the database | How to undo |
|---|---|---|---|
| Deactivate | Kept | Kept | Click "Activate" and everything is back |
| "Delete" in the admin screen | Removed | Removed according to the plugin's own uninstall routine (uninstall.php and so on), if it has one |
Restore from a backup |
wp plugin delete |
Removed | Not removed (the uninstall routine does not run) | Reinstall; the settings are still there |
wp plugin uninstall |
Removed (kept with --skip-delete) |
Runs the uninstall routine | Restore from a backup |
When you click "Delete" in the admin screen, WordPress asks "Are you sure you want to delete (plugin name) and its data?" because this uninstall routine runs. What data is removed differs by plugin: some remove nothing, others drop their own tables.
Step 1: Take a backup
Not only deleting but also deactivating changes how your site looks and works. Before you start, save the database and the plugin's folder. If WP-CLI is available, run the following in the directory where WordPress is installed.
# Export the database
wp db export backup-before-plugin-change.sql
# Archive the plugin's folder (replace example-plugin with the actual folder name)
tar czf example-plugin-backup.tar.gz wp-content/plugins/example-plugin
Move the exported SQL file outside the public directory, or delete it when you are done. If WP-CLI is not available, use a backup plugin or your server's backup feature (How to back up the database).
For plugins that hold order or member data, such as WooCommerce, export the data you need before deleting.
Step 2: Deactivate from the admin screen
- Open "Plugins" → "Installed Plugins" in the admin screen
- Click "Deactivate" under the plugin
- Check how the site looks and the features that depended on the plugin (forms, pages with its shortcodes, widgets and so on)
If other plugins require the plugin (plugin dependencies, WordPress 6.5 and later), you cannot deactivate it until you deactivate the plugins that depend on it.
Once a plugin is deactivated, its shortcodes are no longer processed and the shortcode text appears on the page as is. After deactivating, check that no such text is left on your pages.
Step 3: Delete it if nothing breaks
Leave the plugin deactivated for a while, and delete it if no problems appear. In the admin screen, click "Delete", which appears only for deactivated plugins. Active plugins do not show a "Delete" link.
Because this runs the uninstall routine, the settings may not come back even if you reinstall the same plugin later. If you might reinstall it, leaving it deactivated instead of deleting it is one option. However, the files of a deactivated plugin stay on the server, so it can still be targeted if a vulnerability is found. Delete the plugins you have decided not to use.
Deactivate and delete with WP-CLI
# Check the status
wp plugin list --fields=name,status,version
# Deactivate
wp plugin deactivate example-plugin
# Deactivate, run the uninstall routine, and delete the files
wp plugin uninstall example-plugin --deactivate
# Delete the files only (does not run the uninstall routine)
wp plugin delete example-plugin
# Delete all inactive plugins at once (files only)
wp plugin delete $(wp plugin list --status=inactive --field=name)
wp plugin deleteneither deactivates nor runs the uninstall routine. Stop an active plugin withwp plugin deactivatebefore deleting it.- Adding
--uninstalltowp plugin deactivateruns the uninstall routine after deactivation. - On multisite, stop a network-activated plugin with
wp plugin deactivate example-plugin --network. wp plugin deactivate --alldeactivates every plugin. It is useful for narrowing down a problem, but first record the current state, for example withwp plugin list --status=active --field=name > active-plugins.txt.
Check for leftover data after deletion
If you removed a plugin with wp plugin delete, or deleted a plugin that has no uninstall routine, its settings remain in the database. Most leftovers are harmless, but large options that are autoloaded can slow down page loads.
# Find options whose names contain the plugin's prefix (wildcards are * and ?)
wp option list --search="example_plugin*" --fields=option_name,autoload
# Delete the ones you have confirmed are unneeded
wp option delete example_plugin_settings
# List tables matching the prefix, including ones not registered on $wpdb
wp db tables --all-tables-with-prefix
To drop a table the plugin created, run something like wp db query "DROP TABLE wp_example_plugin_log". Table and option prefixes differ by plugin, and other plugins may use similar names. Before deleting, confirm in the plugin's documentation or source code that the item belongs to that plugin. Deleted data can only be restored from a backup.
How to stop a plugin when you cannot reach the admin screen
If a plugin keeps you out of the admin screen, you have these options.
- Recovery mode: In WordPress 5.2 and later, when a fatal error occurs, a link to recovery mode is sent to the administration email address. Log in through that link and you can deactivate the plugin causing the problem.
- WP-CLI: With
--skip-plugins, as inwp plugin deactivate example-plugin --skip-plugins, WP-CLI runs without loading plugins, so you can deactivate a plugin even if one of them throws errors. - Rename the folder: Using FTP or your server's file manager, rename
wp-content/plugins/example-pluginto something likeexample-plugin.off. The plugin is no longer loaded, and it is deactivated when you open the Plugins screen. Once you are in the admin screen, rename the folder back and then deactivate or delete it properly.
For detailed steps, see How to stop a plugin when you cannot access the admin screen and How to deactivate a plugin from the database.
Must-use plugins placed in wp-content/mu-plugins/ cannot be deactivated from the admin screen. To stop one, move or rename its file.
Checks after the change
- Open your main pages (front page, posts, pages, contact form and so on) and check them
- If the plugin registered custom post types, those pages no longer display. Set up redirects or replacement pages
- If URLs break after deactivation, for example posts or pages return 404, go to "Settings" → "Permalinks" and click "Save Changes" without changing anything; this rebuilds the rewrite rules
- If you use a caching plugin or a CDN, clear the cache before checking
Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)