Skip to main content

wp plugin delete

Overview

Delete plugin files from the filesystem — permanently removing the plugin directory from wp-content/plugins/. Does not clean up database data; use wp plugin uninstall first if the plugin created database tables or options.

What It Does

wp plugin delete removes the plugin directory (e.g. wp-content/plugins/woocommerce/) from disk. It does not:

  • Run the plugin's uninstall routine
  • Remove database tables created by the plugin
  • Remove plugin settings stored in wp_options

For a complete removal, always run wp plugin uninstall before wp plugin delete.

Syntax

wp plugin delete <plugin>... [--all]

Arguments & Options

Argument / FlagDescription
PLUGIN...Plugin slug(s) to delete
--allDelete all installed plugins

Basic Usage

Delete a single plugin

wp plugin delete hello-dolly

Output:

Deleted 'hello-dolly' plugin.
Success: Deleted 1 of 1 plugins.

Delete multiple plugins

wp plugin delete hello-dolly akismet

Delete all plugins (use with extreme caution)

wp plugin delete --all
File deletion is permanent

wp plugin delete removes files from disk with no undo. Always confirm the slug is correct. If you need the plugin back, you'll have to reinstall it.

For plugins that store data, always use the three-step process:

# Step 1: Deactivate
wp plugin deactivate woocommerce

# Step 2: Run uninstall cleanup (removes DB tables and options)
wp plugin uninstall woocommerce

# Step 3: Delete files from disk
wp plugin delete woocommerce

For plugins that store no important data (simple utilities, hello-dolly, etc.):

# Shortcut — deactivate is forced, files are deleted
# (no uninstall hook, so no data to worry about)
wp plugin delete hello-dolly

Real-World Scenarios

Scenario 1: Clean up default WordPress plugins after install

# Remove plugins bundled with WordPress that you don't need
wp plugin deactivate hello akismet
wp plugin delete hello akismet
echo "Default plugins removed ✅"

Scenario 2: Remove a compromised plugin

# Immediate response to a security alert
wp plugin deactivate malicious-plugin --quiet
wp plugin delete malicious-plugin

# Verify it's gone
ls wp-content/plugins/ | grep malicious-plugin || echo "Plugin removed ✅"

# Post-removal security steps
wp core verify-checksums
wp config shuffle-salts

Scenario 3: CI/CD — remove test-only plugins before production deploy

TEST_PLUGINS=("wp-test-plugin" "query-monitor" "debug-bar")
for plugin in "${TEST_PLUGINS[@]}"; do
wp plugin delete "${plugin}" 2>/dev/null && echo "Deleted: ${plugin}" || echo "Not found: ${plugin}"
done

Scenario 4: Remove and reinstall a plugin to fix a corrupted install

wp plugin deactivate broken-plugin
wp plugin delete broken-plugin
wp plugin install broken-plugin --activate

Delete vs Uninstall vs Deactivate

CommandFiles removedDB data removedPlugin turned off
wp plugin deactivate
wp plugin uninstallRequires --deactivate
wp plugin delete✅ (forced)
Full removal (all three)

Best Practices

  1. Always run wp plugin uninstall before wp plugin delete for data-heavy plugins (WooCommerce, ACF, Gravity Forms).
  2. Verify the slug with wp plugin list --field=name before deleting.
  3. Take a backup with wp db export before removing any production plugin.
  4. Keep a list of deleted plugins — document what was removed and why.

Troubleshooting

ProblemCauseFix
Error: The plugin does not existAlready deleted or wrong slugVerify with ls wp-content/plugins/
Plugin data still in DBUninstall hook not runRun wp db query to clean orphaned tables
Permission deniedWP-CLI user can't delete filesFix ownership: chown -R www-data:www-data wp-content/plugins/

Quick Reference

wp plugin delete hello-dolly                   # Delete one plugin
wp plugin delete plugin-a plugin-b # Delete multiple
wp plugin deactivate p && wp plugin uninstall p && wp plugin delete p # Full removal
wp plugin list --field=name # Find correct slug

Next Steps