I know that there is a command to verify the integrity of the core files:

$ wp core verify-checksums 

In case a file is corrupted or altered, is there any WP-CLI command to automatically restore all those files? E.g. download those files from the official repository and restore.

This could be a useful command to run every 24 hours for example, together with any updates, in order to keep the Wordpress installation intact and safe.

1 Answer 1


Just reinstall the current version of WordPress Core with:

wp core download --force

For a bash script, you could modify this one from https://dannyvankooten.com/periodically-check-wp-core-file-modifications/. You would need to make it run the download command, rather than send a notification.

cd /my/wp/directory

if [ -e /tmp/wp-core-verify-checksums-notified ]; then

if [ ! $(wp core verify-checksums) ]; then
        curl https://api.pushbullet.com/api/pushes \
              -u MY_API_KEY: \
              -d type=note \
              -d title="WP checksum verification failed." \
              -d body="Checksum of your WP core files does not match the checksum of original core files. What up with that?" \
              -X POST

        touch /tmp/wp-core-verify-checksums-notified

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.