Checking Your WordPress Core Files with WP-CLI
If you are troubleshooting a WordPress fatal error, and you need to make sure that your WordPress Core files have not been modified, you can use these steps to ensure that you have the right code running your WordPress website.
- SSH into your WordPress hosting environment, using your Web Host’s instructions for doing so.
- Change directories to the root directory containing your WordPress installation. In these examples, the directory ~/public_html is used in place of the root directory for WordPress.
user@wordpress [~]$ cd ~/public_html/
- Check your WordPress Version using the command wp core version:
user@wordpress [~/public_html]$ wp core version 5.2.1
- Check your WordPress Core files using the command wp core verify-checksums:
user@wordpress [~/public_html]$ wp core verify-checksums Success: WordPress installation verifies against checksums.
- Examine the output from the command. Some warnings are OK, such as warnings indicating that an error log should not be present. If core files do not match checksums, you may need to replace your core files, or restore a backup.
- Replace your core files. Please note, if you have modified WordPress deliberately, this step will destroy any changes you have made. Proceed with this step at your own risk. Use the command wp core download –version=5.2.1 –force where “5.2.1” is replaced with the version number you found in step 3.
user@wordpress [~/public_html]$ wp core download --version=5.2.1 --force Downloading WordPress 5.2.1 (en_US)... md5 hash verified: aa13bf5f99e05fe8ab24940b382f2e3f Success: WordPress downloaded.
Congratulations! You now know how to verify your WordPress Core Files, and replace them if needed, using WP-CLI.
Get more for free by signing up with BoldGrid Central Create Account