Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Update WordPress plugin on command line, from slug.
#! /bin/bash
if [ ! -z $1 ]; then
if [[ "$PWD" =~ "plugins" ]]; then
curl -OkLs https://downloads.wordpress.org/plugin/$1.zip
if [ -f $1.zip ]; then
if [ -d $1 ]; then
rm -rf $1
fi # if directory exists
unzip -qq $1.zip
rm -f $1.zip
if [[ `type -t wp` ]]; then
wp plugin list | grep $1
else
echo "Extracted files from $1.zip"
fi # if got wp-cli
else
echo "Error: plugin $1 not found"
echo "Usage: update_zip.sh [plugin slug]"
fi # if zip exists
else
echo "Error: run this script from plugin directory"
fi # pwd
else
echo "Usage: update_zip.sh [plugin slug]"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.