Core Commands
Use core commands to install, update, verify, and recover WordPress safely from the terminal. This lesson focuses on production-safe usage patterns and operational checks.
Understanding Core Commands
Core commands (wp core ...) manage WordPress core files and core lifecycle tasks: download, install, updates, database upgrades, and integrity verification.
Who This Is For
- Developers → Quickly set up new projects.
- Sysadmins → Keep WordPress installations updated.
- Agencies → Automate setup across multiple client sites.
- Security-conscious users → Verify WordPress integrity.
Where You'll Use It
- On local development machines (project scaffolding).
- On remote servers (site deployment & updates).
- In automation scripts (CI/CD pipelines, cron jobs).
When You'll Use Core Commands
- Setting up a new WordPress site.
- Performing manual core updates.
- Migrating or reinstalling a WordPress installation.
- Verifying core file integrity for security.
Why Core Commands Matter
- Provide full control of WordPress core without dashboard access.
- Faster than manual downloads or FTP uploads.
- Enable scripted deployments and recovery.
Command Shape and Subcommands
- Syntax pattern:
wp core <subcommand> [--options]
- Common subcommands:
downloadinstallupdateupdate-dbverify-checksumsversion
For any production update or recovery action, take a database backup first and prefer staging-first promotion. Use --force only when you understand the consequences.
Prerequisites and Preparation
Required Tools
- WP-CLI installed.
- PHP CLI available.
- Database credentials ready for install.
- Write access to WordPress directory.
Preparation
- Navigate to installation path:
cd /var/www/html
- If installing: ensure database is created and accessible.
- If updating: backup files and database first.
Core Command Reference
Use this matrix to pick the right subcommand and the most relevant flags.
Quick Command Matrix
| Command | Syntax | Options / Flags | Purpose |
|---|---|---|---|
| Download | wp core download [--locale=LOCALE] [--version=VERSION] [--force] | --locale=fr_FR → language, --version=6.4.3 → specific version, --force → overwrite | Downloads WordPress core files |
| Install | wp core install --url=URL --title=TITLE --admin_user=USER --admin_password=PASS --admin_email=EMAIL | --skip-email → no notification | Installs WordPress with site details |
| Update | wp core update [--version=VERSION] [--force] | --version → specific version, --force → overwrite | Updates WP core files |
| Update DB | wp core update-db | None | Updates database schema |
| Verify Checksums | wp core verify-checksums | --version=VERSION | Ensures files match official release |
| Version | wp core version [--extra] | --extra → includes PHP & DB versions | Displays WP version |
Core Commands in Practice
Download Core Files (wp core download)
wp core download
Use --version and --locale when you need a specific release or language pack.
wp core download --version=6.2 --locale=fr_FR
wp core download --force overwrites core files. Use it for recovery, not routine upgrades.
Install WordPress (wp core install)
wp core install --url="example.com" --title="My Site" \
--admin_user="admin" --admin_password="secret123" --admin_email="admin@example.com"
Run install only after you have a working wp-config.php and database connectivity.
Update Core Files (wp core update) and Database (wp core update-db)
wp core update --version=6.4.3
If a core update includes database schema changes, follow up with:
wp core update-db
Verify Integrity (wp core verify-checksums)
wp core verify-checksums
This is the fastest way to confirm core files match the official release.
Check Version (wp core version)
wp core version --extra
Benefits
| Benefit | Explanation | Impact |
|---|---|---|
| Speed | Set up WP in seconds | Faster workflows |
| Security | Verify file integrity | Prevent hacks |
| Control | Update specific versions | Exact management |
| Automation | Script deployments | CI/CD ready |
| Recovery | Reinstall or reset core | Site rescue |
Real-World Scenarios
Scenario 1: Download Latest WordPress
wp core download
- Use Case: Fresh local development setup.
Scenario 2: Download Specific Version in French
wp core download --version=6.2 --locale=fr_FR
- Use Case: Testing or multilingual setup.
Scenario 3: Install WordPress
wp core install --url="example.com" --title="My Site" \
--admin_user="admin" --admin_password="secret123" --admin_email="admin@example.com"
- Use Case: First-time installation on new server.
Scenario 4: Update WordPress Core
wp core update --version=6.4.3
- Use Case: Updating site to specific version.
Scenario 5: Update Database Schema
wp core update-db
- Use Case: After upgrading to a new WP version.
Scenario 6: Verify Core Files
wp core verify-checksums
- Use Case: Detect tampered or hacked WordPress files.
Scenario 7: Check Current Version
wp core version --extra
- Use Case: Confirm WP version along with PHP and DB versions.
Best Practices
- Back up before core writes: export the database and snapshot files before updates or forced downloads.
- Promote changes via staging: validate core updates and
update-dbin staging before production. - Verify integrity during incidents: run
wp core verify-checksumsto confirm core file tampering. - Pin versions intentionally: use
--versionin automation only when you document and review upgrade paths. - Scope commands explicitly: use
--pathand--url(or aliases/config) when managing multiple installs. - Treat --force as recovery-only: it is a guardrail bypass, not a default operation.
Troubleshooting
WP-CLI Cannot Find a WordPress Install
Use explicit targeting:
wp --path=/var/www/html core version
Also verify you are running the command from the WordPress root and that wp-config.php exists.
Core Download Fails (Permissions or Disk)
Confirm the user running WP-CLI can write to the WordPress directory and that you have disk space:
wp core download
If you must recover, consider a forced download after you have a backup.
verify-checksums Reports Modified Files
If you intentionally edited core files, revert those changes. Otherwise, treat it as a security signal and re-download core for the same version, then re-run verification:
wp core verify-checksums
Quick Reference
Quick Commands
wp core download # Download latest WordPress
wp core download --version=6.2 # Download specific version
wp core download --locale=fr_FR # Download in French
wp core install --url=example.com --title="Site" \
--admin_user=admin --admin_password=secret --admin_email=me@example.com
wp core update # Update to latest
wp core update --version=6.4.3 # Update to version 6.4.3
wp core update-db # Update database schema
wp core verify-checksums # Verify file integrity
wp core version # Show WP version
wp core version --extra # Show WP + PHP + DB versions
Comparison: Common Core Approaches
| Goal | Recommended Command(s) | When to Use | Notes |
|---|---|---|---|
| Provision a new site | wp core download + wp core install | New environments and fresh installs | Requires database + config readiness |
| Routine updates | wp core update + wp core update-db | Planned maintenance windows | Prefer staging-first promotion |
| Integrity verification | wp core verify-checksums | Incident triage and hardening | Confirms official core file hashes |
| Recovery overwrite | wp core download --force | After tampering/corruption | Backup first; overwrite is destructive |
Treat core operations as a workflow: target the right install, back up, apply changes in staging, then validate integrity in production.
Next Steps
- Continue to Configuration Files to manage
wp-config.phpwith WP-CLI. - Review Global Parameters to scope commands safely across multiple installs.
- For integrity workflows, review Checksum Verification.