Skip to main content

wp core reinstall

Overview

Restore WordPress core files to a known-good state at the currently installed version. The database, wp-config.php, and plugins/themes are untouched. Ideal for incident response and file corruption recovery.

What It Does

wp core reinstall downloads a fresh copy of the WordPress core files at the currently installed version and overwrites them. It does not touch:

  • The database
  • wp-config.php
  • wp-content/ (plugins, themes, uploads)

This makes it safe to run on a live site when you need to replace potentially modified or corrupted core files.

Syntax

wp core reinstall [--locale=<locale>] [--insecure]

Options & Flags

FlagDescription
--locale=LOCALEReinstall in a specific locale (defaults to current install locale)
--insecureSkip SSL verification when downloading

Basic Usage

Reinstall at current version

wp core reinstall

Reinstall with specific locale

wp core reinstall --locale=id_ID

Expected Output

Downloading WordPress 6.7.2 (en_US)...
md5 hash verified: 9a7fa9b67e6b7b0ee7b43a56e0e18b10
Success: WordPress reinstalled successfully.
CommandWhat it doesSafe on live site?
wp core reinstallOverwrite core files at current version✅ Yes
wp core updateUpgrade core to a newer version⚠️ With backup
wp core download --forceDownload core at any version and overwrite⚠️ Specify version carefully
wp core verify-checksumsCheck integrity — does NOT repair✅ Yes (read-only)

Real-World Scenarios

Scenario 1: Post-malware cleanup

# 1. Verify which files are modified
wp core verify-checksums

# 2. Reinstall core to clean state (same version)
wp core reinstall

# 3. Verify again
wp core verify-checksums

# 4. Rotate authentication salts
wp config shuffle-salts

Scenario 2: File corruption after a bad FTP upload

# Site is broken — reinstall core without touching data
wp core reinstall

# Check the site is back
wp core version
curl -s -o /dev/null -w "%{http_code}" https://example.com

Scenario 3: Automation — nightly core file integrity enforcement

#!/bin/bash
if ! wp core verify-checksums --quiet; then
echo "Core file mismatch detected — reinstalling..."
wp core reinstall
wp core verify-checksums
fi

Best Practices

  1. Run wp core verify-checksums first to confirm there are actually modified files.
  2. Take a DB backup first as a safety net, even though the command does not touch the DB.
  3. Follow with wp config shuffle-salts after any security incident.
  4. Confirm the version with wp core version before reinstalling — ensures you're restoring the right version.

Troubleshooting

ProblemCauseFix
Download failsNo internet / firewallCheck connectivity; try --insecure
Reinstall doesn't fix modified filesFiles are in wp-content/ (not core)Check plugins/themes for malware separately
Site still broken after reinstallDB or config issueCheck wp-config.php and run wp db check
Wrong localeDefault locale mismatchSpecify --locale explicitly

Quick Reference

wp core reinstall                          # Reinstall at current version
wp core reinstall --locale=en_US # Force English locale
wp core verify-checksums # Check integrity before and after
wp config shuffle-salts # Rotate salts after security incident

Next Steps