Skip to content

Instantly share code, notes, and snippets.

@nunomorgadinho
Created May 13, 2021 23:39
Show Gist options
  • Save nunomorgadinho/86cd871688c4e6f4d6c4a2a9fcbc34de to your computer and use it in GitHub Desktop.
Save nunomorgadinho/86cd871688c4e6f4d6c4a2a9fcbc34de to your computer and use it in GitHub Desktop.
Temporarily disable all active plugins and the re-enable them
wp plugin list --status=active --format=csv --field=name > plugins.txt
chomd +x enable_plugins.sh
./enable_plugins.sh plugins.txt
#!/bin/bash
# Set variables
# get the temp file with all previously active plugins, file name needs to be
# provided as command line argument ie sh ~/enable_plugins.sh <temp file name>
IFS=$'\r\n' ACTIVE_PLUGINS=($(cat $1))
# loop through the array and reactivate the plugin
for PLUGIN in "${ACTIVE_PLUGINS[@]}"
do
wp plugin activate $PLUGIN
echo $plugin
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment