Skip to main content
All CollectionsWordpress®
Reinstalling WordPress Core files using WP-CLI
Reinstalling WordPress Core files using WP-CLI

This guide provides instructions on how to reinstall the WordPress core files using WP-CLI.

Updated over 2 months ago

We recommend creating a back-up of your website before proceeding.

Reinstall WP Core

  1. Login to your terminal/SSH. If you do not know how - you can follow the guide here

  2. Go to the WordPress Installation Directory by using the following command to navigate to the root directory of your WordPress installation:

    cd public_html

  3. Verify that you're in the correct directory by checking for the presence of the wp-config.php file.

    ls

  4. Optional - If your website has been compromised by malicious files or malware, you can remove these directories before reinstalling the core. This will help eliminate any unwanted code from your website.

    rm -rf wp-admin
    rm -rf wp-includes

  5. Reinstall WordPress Core Files by executing the following command.

    wp core download --force

  6. Update database if needed.

    wp core update-db

That's all! Your core files have been successfully reinstalled.

Did this answer your question?