wp plugin update
Overview
Update WordPress plugins safely from the terminal — all plugins at once, a selection, or to a pinned version. The backbone of automated plugin maintenance workflows.
What It Does
wp plugin update checks for available updates on WordPress.org and downloads and installs the newer version. Plugin files are replaced while the database and settings are preserved. Deactivation is not required before updating.
Syntax
wp plugin update <plugin>... [--all] [--exclude=<slugs>] [--format=<format>] [--version=<version>] [--dry-run] [--insecure]
Arguments & Options
| Argument / Flag | Description |
|---|---|
PLUGIN... | Specific plugin slug(s) to update |
--all | Update all installed plugins |
--exclude=SLUGS | Comma-separated slugs to skip during --all |
--version=VERSION | Force update to a specific version (requires --force) |
--dry-run | Preview updates without applying |
--format=FORMAT | Output format for update report: table, json, csv, yaml |
--insecure | Skip SSL verification |
Basic Usage
Update a single plugin
wp plugin update woocommerce
Update all plugins
wp plugin update --all
Preview all updates (dry run)
wp plugin update --all --dry-run
Output:
+--------------------+---------+-------------+-------+
| name | status | version | update_version |
+--------------------+---------+-------------+-------+
| woocommerce | active | 9.0.1 | 9.1.0 |
| contact-form-7 | active | 5.9.8 | none |
+--------------------+---------+-------------+-------+
Would update 1 of 2 plugins.
Update all except specific plugins
wp plugin update --all --exclude=woocommerce,acf
Downgrade/pin to a specific version
wp plugin update woocommerce --version=8.9.0 --force
The Safe Update Workflow
# 1. Preview what will be updated
wp plugin update --all --dry-run
# 2. Backup the database
wp db export "backup_pre_plugin_update_$(date +%Y%m%d%H%M).sql"
# 3. Enable maintenance mode
wp maintenance-mode activate
# 4. Update all plugins
wp plugin update --all
# 5. Run DB migrations (in case a plugin updated its schema)
wp core update-db
# 6. Disable maintenance mode
wp maintenance-mode deactivate
# 7. Flush cache
wp cache flush
echo "Done. Plugin update complete."
Real-World Scenarios
Scenario 1: Weekly automated update script
#!/bin/bash
LOG="/var/log/wp-plugin-updates.log"
echo "=== Plugin Update: $(date) ===" >> $LOG
# Backup
wp --path=/var/www/html db export /var/backups/wp/plugin_update_$(date +%Y%m%d).sql >> $LOG 2>&1
# Update all (exclude pinned versions)
wp --path=/var/www/html plugin update --all \
--exclude=acf,my-custom-plugin \
--format=json >> $LOG 2>&1
wp --path=/var/www/html cache flush >> $LOG 2>&1
echo "Update complete." >> $LOG
Scenario 2: Update with version report
# Check what the versions will change to
wp plugin update --all --dry-run --format=json | \
python3 -c "
import sys, json
data = json.load(sys.stdin)
for p in data:
if p['update_version']:
print(f\"{p['name']}: {p['version']} → {p['update_version']}\")
"
Scenario 3: Multi-site — update plugins on all sites
SITES=("/var/www/site1" "/var/www/site2" "/var/www/site3")
for site in "${SITES[@]}"; do
echo "Updating plugins on ${site}..."
wp --path="${site}" plugin update --all
done
Scenario 4: Update only security-patched plugins
# Update only specific security-patched plugins after a vulnerability advisory
wp plugin update wordfence really-simple-ssl
wp cache flush
Best Practices
- Always run
--dry-runfirst on production — verify what will change. - Back up the DB before updating — plugin updates can change DB schemas.
- Use
--excludeto protect manually pinned plugins from accidental updates. - Use maintenance mode on busy sites during updates.
- Test updates on staging first before applying to production.
- Update plugins, then themes, then core — in that order for compatibility.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Update breaks site | Plugin incompatibility | Restore DB backup; rollback with --version OLD |
Plugin not found on --all | Plugin from non-WP.org source | Skip with --exclude; update manually |
| Already at latest version | No updates available | Normal — wp plugin list --update=available to confirm |
| SSL error during download | Server CA issue | Use --insecure |
Quick Reference
wp plugin update --all # Update everything
wp plugin update --all --dry-run # Preview only
wp plugin update woocommerce # Single plugin
wp plugin update --all --exclude=acf,my-plugin # Skip specific
wp plugin update woocommerce --version=8.9.0 --force # Pin version
Next Steps
wp plugin list --update=available— see which plugins have updates before running.wp plugin auto-updates— enable automatic background updates.wp cache flush— flush cache after updating.