Reinstalling WordPress Core Files with WP-CLI (Firstserv Guide)

This guide explains how to safely reinstall the WordPress core files using WP-CLI. This can help resolve issues caused by corrupted or missing core files without affecting your content.


Prerequisites

Before you begin:

  • ✅ It is strongly recommended to back up your website
  • ✅ Ensure you have SSH access enabled on your hosting account
    • (Available on most Firstserv plans)

Step-by-Step Instructions

1. Access Terminal / SSH

Connect to your server using one of the following:

  • cPanel → Terminal
  • An SSH client (e.g. PuTTY or Terminal)

2. Navigate to Your WordPress Directory

Move to your WordPress installation directory, usually:

 
 
 
 
 
 
Shell
 
 
cd /public_html
``
 
 

(Adjust the path if your site is installed in a subdirectory.)


3. Confirm You’re in the Correct Directory

Check that the directory contains your WordPress files by looking for wp-config.php:

 
 
 
 
 
 
Shell
 
 
ls
 
 

You should see files such as:

  • wp-config.php
  • wp-content/
  • wp-admin/

4. Reinstall WordPress Core Files

Run the following command:

 
 
 
 
 
 
Shell
 
 
wp core download --force
 
 

✅ This will:

  • Download fresh WordPress core files
  • Replace existing core files

⚠️ It will not modify:

  • Your wp-config.php file
  • Your wp-content folder (themes, plugins, uploads)

5. Clear Cache (Optional)

If you're using LiteSpeed Cache, clear the cache to ensure changes take effect:

 
 
 
 
 
 
Shell
 
 
wp litespeed-purge all
 
 

6. Verify Your Website

  • Visit your website and admin area
  • Confirm that everything is working correctly

7. Update Database (If Prompted)

If WordPress indicates a database update is required, run:

 
 
 
 
 
 
Shell
 
 
wp core update-db
 
 

When to Use This Method

Reinstalling WordPress core files is useful when:

  • Core files are corrupted or missing
  • You encounter unexplained errors
  • Updates have failed or caused issues

Summary

Using WP-CLI to reinstall WordPress:

  • Refreshes core files safely
  • Preserves your content and configuration
  • Helps resolve common issues quickly

If you need help accessing SSH or running WP-CLI commands, the Firstserv support team is always available to assist.

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to install the Wordpress Litespeed cache plugin

  LiteSpeed Cache – What It Is and How It Helps If you’re running a WordPress website and...

How to disable the WordPress CRON job and set it up in cPanel

  Optimising WordPress Cron (wp-cron) – Firstserv WordPress does not...

Fixing WordPress mixed content issues

  Fixing Mixed Content Warnings When you visit a website using https://, your browser expects...

How to optimise your WordPress site

Optimising Your WordPress Website (Firstserv Guide) WordPress is a...

Configuring Redis Object Caching using Litespeed Cache

Object Caching and Redis (Firstserv Guide) What is Object Caching? Object caching is a...