Skip to main content

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 / FlagDescription
PLUGIN...Plugin slug(s) to deactivate
--allDeactivate all active plugins
--networkDeactivate network-wide on a multisite
--uninstallRun the plugin's uninstall routine after deactivating
--quietSuppress 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​

  1. Use --all for plugin conflict debugging — it's the fastest way to isolate a broken plugin.
  2. Never use --uninstall without a backup — it permanently deletes plugin data.
  3. Use --network consistently on multisites — standard deactivate only affects a single site.
  4. Log which plugins were active before mass deactivation with wp plugin list --status=active --field=name &gt; active_before.txt.

Troubleshooting​

ProblemCauseFix
Warning: Plugin not activeAlready inactiveUse wp plugin status to verify
Site still broken after --allIssue is theme, not pluginTry wp theme activate twentytwentyfour
Network deactivation doesn't work--network not usedAdd --network on multisites
Data lost after deactivation--uninstall was usedRestore 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​