Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#Your First need to install wordpress cli as describe : https://wp-cli.org/
#Try running
wp help
#and if you get an error run the following :
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
#Should display system informations
#If there is no errors make it executable and move it to path :
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
#You should now be able to run :
wp help
#Now that we have wp cli we can use it to update wordpress from command line
#You first need to know your wordpress installation path
locate wp-config.php
#e.g : /var/www/html/wp-config.php
#Then run the update command with the installation path you got above
wp core update --path='/var/www/html/'
#Success: WordPress is up to date.
#Bonus: you can then add it to your unix cron to be run once a week as follow :
sudo crontab -e
#paste the following in a new line
30 5 * * 3 wp core update --path='/var/www/html/'
#wq!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment