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
| Flag | Default | Description |
|---|---|---|
--version=VERSION | Latest stable | Target a specific WordPress version |
--force | — | Reinstall even if already at target version |
--locale=LOCALE | Current locale | Apply a different language |
--insecure | — | Skip SSL verification |
--minor | — | Only 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
- Always take a DB backup with
wp db exportbefore updating. - Enable maintenance mode on production sites during the update window.
- Use
--minorfor security-only patches when you want to minimize risk. - Always follow with
wp core update-db— never skip the DB step. - Test in staging first before updating production.
- Verify after update with
wp core verify-checksums.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Update fails mid-way | Disk full or permissions issue | Check disk space and ownership |
| Site breaks after update | Plugin/theme incompatibility | Restore DB backup; test in staging |
| Admin shows "DB update required" | update-db not run | Run wp core update-db |
| Update re-runs same version | Corrupted version marker | Run 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
wp core update-db— always run after updating files.wp core verify-checksums— confirm integrity after update.wp plugin update --all— update plugins after core.wp maintenance-mode activate— enable maintenance mode during updates.