Skip to content

Instantly share code, notes, and snippets.

@runningman84
Created September 26, 2019 12:25
Show Gist options
  • Save runningman84/25cc03309534fe415fce23221b7accac to your computer and use it in GitHub Desktop.
Save runningman84/25cc03309534fe415fce23221b7accac to your computer and use it in GitHub Desktop.
wp-plugin
#!/bin/bash
if [ "$WP_PLUGINS" = "" ]
then
echo "please define WP_PLUGINS"
exit 1
fi
cd /app
for plugin in $WP_PLUGINS
do
echo "activating wp plugin $plugin..."
PLUGIN_CHECK="$(wp plugin is-installed $plugin --debug)"
if [ $? -eq 0 ]; then
PLUGIN_CHECK="$(wp plugin is-active $plugin --debug)"
if [ $? -eq 0 ]; then
echo "error wp plugin $plugin is already active"
else
wp plugin activate $plugin --allow-root --debug
fi
else
echo "error wp plugin $plugin is not installed"
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment