Skip to main content

wp core update

Overview

Upgrade WordPress core files to the latest release or a specific version without touching the dashboard. The foundation of a safe, automated WordPress maintenance workflow.

What It Does

wp core update downloads and installs a new version of WordPress core. It replaces core PHP files while leaving wp-content/ and wp-config.php untouched. After updating files, always follow up with wp core update-db to apply any pending schema changes.

Syntax

wp core update [--version=<version>] [--force] [--locale=<locale>] [--insecure]

Options & Flags

FlagDefaultDescription
--version=VERSIONLatest stableTarget a specific WordPress version
--forceReinstall even if already at target version
--locale=LOCALECurrent localeApply a different language
--insecureSkip SSL verification
--minorOnly update within the same minor version (security patches only)

Basic Usage

Update to the latest stable release

wp core update

Update to a specific version

wp core update --version=6.4.3

Force reinstall of current version

wp core update --force

Apply security patches only (minor updates)

wp core update --minor

Expected Output

When an update is available:

Updating to version 6.7.2 (en_US)...
Downloading update from https://downloads.wordpress.org/release/wordpress-6.7.2.zip...
Unpacking the update...
Cleaning up files...
No files found that need updating.
Success: WordPress updated successfully.

When already up to date:

Success: WordPress is at the latest version.

The Full Update Workflow

# 1. Backup database
wp db export backup_$(date +%Y%m%d).sql

# 2. Enable maintenance mode
wp maintenance-mode activate

# 3. Update WordPress core
wp core update

# 4. Run DB schema migrations
wp core update-db

# 5. Disable maintenance mode
wp maintenance-mode deactivate

# 6. Verify integrity
wp core verify-checksums

echo "Done. Version: $(wp core version)"

Real-World Scenarios

Scenario 1: Scheduled weekly maintenance (cron)

#!/bin/bash
LOG="/var/log/wp-updates.log"
echo "=== $(date) ===" >> $LOG
wp --path=/var/www/html db export /var/backups/wp_$(date +%Y%m%d).sql >> $LOG 2>&1
wp --path=/var/www/html maintenance-mode activate >> $LOG 2>&1
wp --path=/var/www/html core update >> $LOG 2>&1
wp --path=/var/www/html core update-db >> $LOG 2>&1
wp --path=/var/www/html plugin update --all >> $LOG 2>&1
wp --path=/var/www/html maintenance-mode deactivate >> $LOG 2>&1
echo "Version: $(wp --path=/var/www/html core version)" >> $LOG

Scenario 2: Pin a specific version for compatibility testing

# Update to a pinned version
wp core update --version=6.5.0

# Test compatibility
# ...

# Then update to latest when ready
wp core update

Scenario 3: Security patch only (do not jump major versions)

wp core update --minor
wp core update-db

Scenario 4: Multi-site update

SITES=("/var/www/site1" "/var/www/site2" "/var/www/site3")
for site in "${SITES[@]}"; do
echo "Updating ${site}..."
wp --path="${site}" core update
wp --path="${site}" core update-db
done

Best Practices

  1. Always take a DB backup with wp db export before updating.
  2. Enable maintenance mode on production sites during the update window.
  3. Use --minor for security-only patches when you want to minimize risk.
  4. Always follow with wp core update-db — never skip the DB step.
  5. Test in staging first before updating production.
  6. Verify after update with wp core verify-checksums.

Troubleshooting

ProblemCauseFix
Update fails mid-wayDisk full or permissions issueCheck disk space and ownership
Site breaks after updatePlugin/theme incompatibilityRestore DB backup; test in staging
Admin shows "DB update required"update-db not runRun wp core update-db
Update re-runs same versionCorrupted version markerRun with --force

Quick Reference

wp core update                           # Update to latest
wp core update --version=6.4.3 # Specific version
wp core update --minor # Security patches only
wp core update --force # Force reinstall of current
wp core update && wp core update-db # Full update in one line

Next Steps