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 / Flag | Description |
|---|---|
PLUGIN... | Plugin slug(s) to delete |
--all | Delete 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.
Full Removal Workflow (Recommended)
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
| Command | Files removed | DB data removed | Plugin turned off |
|---|---|---|---|
wp plugin deactivate | ❌ | ❌ | ✅ |
wp plugin uninstall | ❌ | ✅ | Requires --deactivate |
wp plugin delete | ✅ | ❌ | ✅ (forced) |
| Full removal (all three) | ✅ | ✅ | ✅ |
Best Practices
- Always run
wp plugin uninstallbeforewp plugin deletefor data-heavy plugins (WooCommerce, ACF, Gravity Forms). - Verify the slug with
wp plugin list --field=namebefore deleting. - Take a backup with
wp db exportbefore removing any production plugin. - Keep a list of deleted plugins — document what was removed and why.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
Error: The plugin does not exist | Already deleted or wrong slug | Verify with ls wp-content/plugins/ |
| Plugin data still in DB | Uninstall hook not run | Run wp db query to clean orphaned tables |
| Permission denied | WP-CLI user can't delete files | Fix 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
wp plugin uninstall— clean up plugin data before deleting files.wp plugin install— reinstall if needed.wp plugin list— audit what's installed after deletion.