WordPress
How do I update WordPress with WP-CLI over SSH and check its integrity?
Connect with the site user, change to the directory containing wp-config.php, and back up the database. Do not use --allow-root.
ssh user@server.example
cd /path/to/the/site
wp core version
wp plugin status
wp theme status
wp db export "../backups/db-$(date +%Y%m%d-%H%M%S).sql"
First simulate the updates:
wp core update --dry-run
wp plugin update --all --dry-run
wp theme update --all --dry-run
If everything is correct, update the site:
wp maintenance-mode activate
wp core update
wp core update-db
wp plugin update --all
wp theme update --all
wp cache flush
wp maintenance-mode deactivate
Then check integrity:
wp core verify-checksums --include-root
wp plugin verify-checksums --all
wp theme verify-checksums --all
wp core version
wp plugin status
wp theme status
Plugin and theme checksums are available only for packages from WordPress.org. A premium, custom or modified package may therefore be unverifiable without being compromised. If a command fails, delete nothing: keep the WP-CLI output and restore the backup or request a review. Finally test the home page, administration, forms and important site functions.