Skip to main content

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 / FlagDescription
PLUGIN...Specific plugin slug(s) to update
--allUpdate all installed plugins
--exclude=SLUGSComma-separated slugs to skip during --all
--version=VERSIONForce update to a specific version (requires --force)
--dry-runPreview updates without applying
--format=FORMATOutput format for update report: table, json, csv, yaml
--insecureSkip 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

  1. Always run --dry-run first on production — verify what will change.
  2. Back up the DB before updating — plugin updates can change DB schemas.
  3. Use --exclude to protect manually pinned plugins from accidental updates.
  4. Use maintenance mode on busy sites during updates.
  5. Test updates on staging first before applying to production.
  6. Update plugins, then themes, then core — in that order for compatibility.

Troubleshooting

ProblemCauseFix
Update breaks sitePlugin incompatibilityRestore DB backup; rollback with --version OLD
Plugin not found on --allPlugin from non-WP.org sourceSkip with --exclude; update manually
Already at latest versionNo updates availableNormal — wp plugin list --update=available to confirm
SSL error during downloadServer CA issueUse --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