Created
May 13, 2021 23:39
-
-
Save nunomorgadinho/86cd871688c4e6f4d6c4a2a9fcbc34de to your computer and use it in GitHub Desktop.
Temporarily disable all active plugins and the re-enable them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp plugin list --status=active --format=csv --field=name > plugins.txt | |
chomd +x enable_plugins.sh | |
./enable_plugins.sh plugins.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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