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
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
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