Skip to content

Instantly share code, notes, and snippets.

@chrisjangl
Created November 24, 2021 12:32
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 chrisjangl/033986391dfa20696707de165961d48a to your computer and use it in GitHub Desktop.
Save chrisjangl/033986391dfa20696707de165961d48a to your computer and use it in GitHub Desktop.
Working from a list of WordPress sites on a shared hosting environment (sites.txt), create a report of each sites WordPress version.
# prints a report of the WP version
i=1
touch version.txt
COUNT=$(wc -l sites.txt)
for SITE in $(cat sites.txt)
do
cd $SITE
echo "Working on $SITE ($i of $COUNT)..."
echo "## $SITE" >> ../version.txt
url=$(wp option get siteurl)
version=$(wp core version)
echo $url >> ../version.txt
echo $version >> ../version.txt
echo "----------------" >> ../version.txt
echo " " >> ../version.txt
echo " " >> ../version.txt
echo " " >> ../version.txt
((i=i+1))
clear
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment