wp plugin deactivate
Overview
Deactivate one or more plugins from the terminal — without wp-admin access. Essential for emergency debugging, plugin conflict isolation, and deployment pipelines.
What It Does
wp plugin deactivate triggers WordPress's plugin deactivation routine for the specified plugin(s). Deactivation hooks run as expected. The plugin files remain on disk — only the active state is changed.
Syntax
wp plugin deactivate <plugin>... [--all] [--network] [--uninstall] [--quiet]
Arguments & Options
| Argument / Flag | Description |
|---|---|
PLUGIN... | Plugin slug(s) to deactivate |
--all | Deactivate all active plugins |
--network | Deactivate network-wide on a multisite |
--uninstall | Run the plugin's uninstall routine after deactivating |
--quiet | Suppress output |
Basic Usage
Deactivate a single plugin
wp plugin deactivate woocommerce
Output:
Plugin 'woocommerce' deactivated.
Success: Deactivated 1 of 1 plugins.
Deactivate multiple plugins
wp plugin deactivate contact-form-7 yoast-seo
Deactivate all active plugins (emergency debug)
wp plugin deactivate --all
Deactivate network-wide (multisite)
wp plugin deactivate woocommerce --network
Deactivate and run uninstall routine
wp plugin deactivate woocommerce --uninstall
--uninstall removes plugin data
--uninstall triggers the plugin's uninstall hook which typically deletes all plugin-created database tables, options, and custom post types. This may be irreversible.
Real-World Scenarios
Scenario 1: Emergency — WordPress broken, can't access wp-admin
# Deactivate all plugins to isolate the issue
wp plugin deactivate --all
# Test if site loads
curl -s -o /dev/null -w "%{http_code}" https://example.com
# Reactivate one by one to find culprit
wp plugin activate contact-form-7
wp plugin activate yoast-seo
# ... until issue returns
Scenario 2: Pre-update staging safety deactivation
# Deactivate problematic plugins before a major WP core update
wp plugin deactivate plugin-known-to-break-on-updates
# Run update
wp core update && wp core update-db
# Reactivate after testing
wp plugin activate plugin-known-to-break-on-updates
Scenario 3: Deactivate all except a whitelist
KEEP=("woocommerce" "yoast-seo" "litespeed-cache")
# Get all active plugins
ALL_ACTIVE=$(wp plugin list --status=active --field=name)
for plugin in $ALL_ACTIVE; do
if ! printf '%s\n' "${KEEP[@]}" | grep -q "^${plugin}$"; then
wp plugin deactivate "${plugin}"
fi
done
Scenario 4: CI/CD — deactivate before running tests
# Ensure only test-relevant plugins are active
wp plugin deactivate --all --quiet
wp plugin activate woocommerce --quiet
wp plugin activate woo-test-helper --quiet
Best Practices
- Use
--allfor plugin conflict debugging — it's the fastest way to isolate a broken plugin. - Never use
--uninstallwithout a backup — it permanently deletes plugin data. - Use
--networkconsistently on multisites — standard deactivate only affects a single site. - Log which plugins were active before mass deactivation with
wp plugin list --status=active --field=name > active_before.txt.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
Warning: Plugin not active | Already inactive | Use wp plugin status to verify |
Site still broken after --all | Issue is theme, not plugin | Try wp theme activate twentytwentyfour |
| Network deactivation doesn't work | --network not used | Add --network on multisites |
| Data lost after deactivation | --uninstall was used | Restore from backup |
Quick Reference
wp plugin deactivate woocommerce # Single
wp plugin deactivate plugin-a plugin-b # Multiple
wp plugin deactivate --all # All plugins (debug)
wp plugin deactivate --all --network # All network-wide
wp plugin deactivate bad-plugin --uninstall # Deactivate + cleanup
Next Steps
wp plugin activate— reactivate plugins.wp plugin list— see current status of all plugins.wp plugin delete— remove plugin files from disk.