Keeping your WordPress site healthy from the command line

a colorful guide to wordpress administration

Step1) Backup your files and your database before upgrading!

D=$(date +'%Y%m%d%H%M%S')

cd ${P}/${S}
wp db export /tmp/${S}-${D}.sql

cd ${P}
tar --exclude=${S}/wp-content/uploads -zcf /tmp/${S}-${D}.tgz ${S}

Step 2)
WordPress CORE updates

Probe for updates

wp core check-update

Perform Update

wp core update 

Step 3)
WordPress CORE database

Check for database updates

wp core update-db --dry-run

Perform DB update

wp core update-db

Step 4)
Update Plugins

Check for updates

wp plugin update --all --dry-run

Perform the upgrade

wp plugin update --all