1 Commits
Author SHA1 Message Date
Pratham Rangwala 4b45a4abee Add script to output plugins using wp-cli 2025-10-13 21:14:27 -07:00
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# Usage:
# ./export-wp-plugins.sh [base_directory] [output_file]
BASE_DIR="${1:-/var/www}"
OUTPUT_FILE="${2:-plugins.csv}"
# Check for WP-CLI
if ! command -v wp &>/dev/null; then
echo "WP-CLI not found. Install WP-CLI first: https://wp-cli.org/"
exit 1
fi
# Loop through subdirectories
for dir in "$BASE_DIR"/*/; do
if [ -f "$dir/wp-config.php" ]; then
site=$(basename "$dir")
echo "=== $site ===" | tee -a "$OUTPUT_FILE"
wp --allow-root --path="$dir" plugin list --format=csv>> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
fi
done
echo "Plugins saved to $OUTPUT_FILE"