Skip to main content

Core Commands

Overview

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:
    • download
    • install
    • update
    • update-db
    • verify-checksums
    • version
Production Safety

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

  1. Navigate to installation path:
cd /var/www/html

  1. If installing: ensure database is created and accessible.
  2. 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

CommandSyntaxOptions / FlagsPurpose
Downloadwp core download [--locale=LOCALE] [--version=VERSION] [--force]--locale=fr_FR → language, --version=6.4.3 → specific version, --force → overwriteDownloads WordPress core files
Installwp core install --url=URL --title=TITLE --admin_user=USER --admin_password=PASS --admin_email=EMAIL--skip-email → no notificationInstalls WordPress with site details
Updatewp core update [--version=VERSION] [--force]--version → specific version, --force → overwriteUpdates WP core files
Update DBwp core update-dbNoneUpdates database schema
Verify Checksumswp core verify-checksums--version=VERSIONEnsures files match official release
Versionwp core version [--extra]--extra → includes PHP & DB versionsDisplays 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

Using --force

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

BenefitExplanationImpact
SpeedSet up WP in secondsFaster workflows
SecurityVerify file integrityPrevent hacks
ControlUpdate specific versionsExact management
AutomationScript deploymentsCI/CD ready
RecoveryReinstall or reset coreSite 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

  1. Back up before core writes: export the database and snapshot files before updates or forced downloads.
  2. Promote changes via staging: validate core updates and update-db in staging before production.
  3. Verify integrity during incidents: run wp core verify-checksums to confirm core file tampering.
  4. Pin versions intentionally: use --version in automation only when you document and review upgrade paths.
  5. Scope commands explicitly: use --path and --url (or aliases/config) when managing multiple installs.
  6. 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

GoalRecommended Command(s)When to UseNotes
Provision a new sitewp core download + wp core installNew environments and fresh installsRequires database + config readiness
Routine updateswp core update + wp core update-dbPlanned maintenance windowsPrefer staging-first promotion
Integrity verificationwp core verify-checksumsIncident triage and hardeningConfirms official core file hashes
Recovery overwritewp core download --forceAfter tampering/corruptionBackup first; overwrite is destructive
Key Takeaway

Treat core operations as a workflow: target the right install, back up, apply changes in staging, then validate integrity in production.

Next Steps