Skip to content

Instantly share code, notes, and snippets.

@CedricL46
Last active January 6, 2020 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CedricL46/8147ed8ff2c708b02f5281851b491541 to your computer and use it in GitHub Desktop.
Save CedricL46/8147ed8ff2c708b02f5281851b491541 to your computer and use it in GitHub Desktop.
#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