Wordpress reinstall Core using wp-cli

This document shows how to reinstall wordpress core files using wp-cli from a terminal. wp-cli needs to be installed. Enter wp --info in the terminal to check. You can also use FTP as in this article https://community.reclaimhosting.com/t/replacing-wordpress-core-files/3294

get version inside wordpress install directory

Cat command reads the version.php file to get the version number, while grep looks for the text ‘wp_version’

cat wp-includes/version.php | grep wp_version

Screen Shot 2021-01-21 at 12.49.26 PM

delete wp-admin and wp-includes directories (optional)

If malware is suspected for example you can delete the wp-admin and wp-includes directories. rm stands for remove and we are using -r for recursive to delete all the subdirectories and files and -f for force without prompting.

rm -rf wp-admin wp-includes

reinstall using version

This is the wp-cli command to download the core files, while skipping the content folder (wp-content) and using in this case version 5.6.

wp core download --force --skip-content --version=5.6

Screen Shot 2021-01-21 at 12.52.33 PM
Screen Shot 2021-01-21 at 12.54.18 PM

reinstall using version and locale (optional)

You can also specify the locale if needed to any language available for Wordpress.

wp core download --force --skip-content --locale=en_US --version=5.6

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request