Reinstalling WordPress Core Files Using WP-CLI
This guide explains how to reinstall the WordPress Core files using WP-CLI.
Prerequisites
- Backup your WordPress site (optional but recommended).
Steps to Reinstall WordPress Core
- Login to Terminal/SSH Access the server via SSH or using the cPanel terminal.
- All packages except Amethyst come with SSH - you may need to enable it first following this guide here - Navigate to the WordPress Installation Directory Use the following command to go to your WordPress root directory:
cd /public_html
- Ensure You're in the Correct Directory Confirm that you're in the WordPress directory by checking for
wp-config.php
:
ls
- Reinstall WordPress Core Files Execute the following command to reinstall the WordPress core files:
wp core download --force
This command downloads and replaces core files without altering your wp-config.php
or wp-content
.
- Clear Cache (optional) Clear your cache if necessary:
wp litespeed-purge all
- Verify Site Check your site to ensure it’s working correctly.
- Update Database (if needed) If prompted, update your database:
wp core update-db