Skip to content

Instantly share code, notes, and snippets.

@bhubbard
Created March 9, 2019 04:03
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 bhubbard/44ace4313ff5719b9494c7ac2c502cc8 to your computer and use it in GitHub Desktop.
Save bhubbard/44ace4313ff5719b9494c7ac2c502cc8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# purpose delete inactive WordPress themes
WPPATH=""
WPFLAGS="--path=${WPPATH} --skip-plugins --skip-themes --allow-root"
THEMEEXCEPTIONS=(
twentynineteen
)
THEMELIST=($(wp theme list --fields=name --status=inactive ${WPFLAGS}))
for THEME in ${THEMELIST[@]}
do
if [[ ! " ${THEMEEXCEPTIONS[@]} " =~ " ${THEME} " ]]; then
wp theme delete ${THEME} ${WPFLAGS}
fi
done
@PalmaSolutions
Copy link

Would this delete a parent theme provided when a child is active?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment