Last active
August 31, 2021 14:22
-
-
Save ebta/55318a9679d6c0426d9ff90aeef5ad29 to your computer and use it in GitHub Desktop.
Update worpress, plugins and theme using wp-cli from Cron
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Simple script to update a WordPress install (core, plugins, themes and languages) using wp-cli. | |
# Usually we expect to run this from cron. | |
# Written by Kitson Consulting and released into the public domain. | |
if [ $# -ne 1 ] | |
then | |
echo "Usage: $0 </path/to/wordpress/install>" >&2 | |
exit 1 | |
fi | |
if [ ! -d "$1" ] | |
then | |
echo "$1 does not appear to be a directory. Exiting." >&2 | |
exit 2 | |
fi | |
if [ ! -f "$1"/wp-config.php ] | |
then | |
echo "$1/wp-config.php does not exist. Did you specify the path to a WordPress install?" >&2 | |
exit 3 | |
fi | |
wp core update --path="$1" --quiet | |
wp plugin update --all --path="$1" --quiet | |
wp theme update --all --path="$1" --quiet | |
wp language core update --path="$1" --quiet | |
wp language plugin update --all --path="$1" --quiet | |
wp language theme update --all --path="$1" --quiet | |
# Usage | |
# ./wp-update /path/to/wordpress/site |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment