3年后,我用下面的shell脚本解决了这个问题:
#Getting list of outdated themes
/usr/local/bin/wp theme list --update=available --allow-root --path=/var/www | sed -n \'1!p\' | awk \'{print $1}\' > /tmp/theme.list
#Update them one by one
while read -r themename
do
#Store the old version number of theme
OLDVER="$(grep Version: /var/www/wp-content/themes/"$themename"/style.css)"
#Download theme
wget -q https://downloads.wordpress.org/theme/"$themename".zip -P /tmp/
#Uncompress .zip file
unzip -oq /tmp/"$themename".zip -d /var/www/wp-content/themes/
#Store the new version number of theme
NEWVER="$(grep Version: /var/www/wp-content/themes/"$themename"/style.css)"
#Create simple log file of theme update
[[ "$OLDVER" != "$NEWVER" ]] && echo "$themename" >> /tmp/success.list || echo "$themename" >> /tmp/failed.list
#Remove downloaded theme file
rm /tmp/"$themename".zip
done < /tmp/theme.list
rm /tmp/theme.list