Created
November 1, 2024 07:59
-
-
Save Sam-R/3d7cc89a6f02e823cbf6d65d2a2dd23d to your computer and use it in GitHub Desktop.
Script to bulk update wordpress sites, plugins and themes using wp-cli
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/bash | |
################### | |
# Script to update wordpress sites, plugins and themes | |
# Created by: Sam R. | |
# Created at: 2024-11-01 | |
# Usage: | |
# - edit the script BASE_PATH as appropriate | |
# - add the site directories to the SITES array | |
# - run the script ./wordpress-update.sh | |
################### | |
WP_CLI_COMMAND="$HOME/bin/wp-cli.phar" | |
BASE_PATH="/var/www" | |
SITES=( | |
"example.com" | |
) | |
for i in "${SITES[@]}"; do | |
echo "# === UPDATING SITE CORE: ${i}" | |
${WP_CLI_COMMAND} core update --path="${BASE_PATH}/${i}" | |
echo "# === UPDATING SITE PLUGINS: ${i}" | |
${WP_CLI_COMMAND} plugin update --path="${BASE_PATH}/${i}" --all | |
echo "# === UPDATING SITE THEMES: ${i}" | |
${WP_CLI_COMMAND} theme update --path="${BASE_PATH}/${i}" --all | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment