If you suspect that any WordPress files have been changed, corrupted, or infected with malware, you can use WP-CLI to verify or check the integrity of your WordPress files directly from the server.
WP-CLI will compare the WordPress files on your server with the official checksums from WordPress.org. If any files differ, the results will be displayed as a warning.
Causes of WordPress File Integrity Changes
Some common reasons why WordPress files do not match the checksum:
- WordPress core files were modified by a plugin or theme.
- There is malware that has injected code into WordPress files.
- The WordPress update process did not complete successfully.
- There were manual changes made to WordPress core files.
- WordPress files were corrupted during the upload or migration process.
How to Check WordPress File Integrity
Before you begin, ensure that the server or hosting you are using supports WP-CLI. If it does not, you can install it first: How to Install WP-CLI.
1. Verify the WP-CLI Version
Make sure you are using the latest version of WP-CLI and that it is installed.
wp --version2. Open the WordPress Installation Folder
To perform a file integrity check, you need to open your WordPress installation folder, for example, the public_html.
cd public_html3. Check File Integrity
Once you are in the WordPress installation folder, you can perform the file integrity check.
wp core verify-checksumsIf there are no files outside of the original WordPress files, you will receive a success message like this.
Success: WordPress installation verifies against checksums.If there are files outside of the core or files not required by WordPress, a list of the detected file locations will appear, for example like this.
Warning: File doesn't verify against checksum: wp-admin/about.phpWarning: File should not exist: wp-admin/contoh-file.phpError: WordPress installation doesn't verify against checksums.If the warning message is File doesn’t verify against checksum, it means the file is indeed a WordPress file, but it has been modified manually.
4. Check Integrity for Specific Versions and Languages
If you want to perform an integrity check on a specific WordPress version, for example version 7.0 and the Indonesian language, you can use an additional flag , for example.
wp core verify-checksums --version=7.0 --locale=id_IDThose are the steps and methods to examine or check WordPress file integrity using WP-CLI. As additional information, for WordPress 7.0, sometimes the checksum in WP-CLI has not been updated and AI files that should be in WordPress 7.0 are sometimes still read as an error or false positive.
FAQ
Does wp core verify-checksums check plugins and themes?
No, the wp core verify-checksums command only checks WordPress core files. For plugin checks, you can use a different command:
wp plugin verify-checksums --allWhy does the checksum still fail after re-downloading?
This failure is usually caused by several factors:
- The checksum has not been updated, for example in WordPress 7.0 which is sometimes still a False Positive.
- The WordPress version does not match.
- The WordPress locale is different (for example id_ID).
- There are additional files that are not included in the official WordPress package.
- Files were modified by malware or custom code.
COMMENTS
Loading...