Last active
June 5, 2025 12:43
-
-
Save marceltannich/de2df70d09d33c56c423aaefd06bb599 to your computer and use it in GitHub Desktop.
Example script to automate WordPress setups
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 | |
# 1) Adjust the script to your needs | |
# 2) Set the permission to run it with chmod +x wp-setup.sh | |
# 3) Call the script via ./wp-setup.sh | |
echo "π WordPress Automated Setup" | |
echo "βββββββββββββββββββββββββββββββββββββββββ" | |
# User prompts | |
read -p "Install WordPress core? (Y/n): " INSTALL_CORE | |
INSTALL_CORE=${INSTALL_CORE:-Y} | |
if [[ ! "$INSTALL_CORE" =~ ^[Yy]$ ]]; then | |
echo "β Installation skipped." | |
exit 0 | |
fi | |
read -p "Site title: " SITE_TITLE | |
SITE_TITLE=${SITE_TITLE:-"My Demo Site"} | |
# Install WordPress | |
echo "π¦ Installing WordPress..." | |
wp core download | |
# Configure WordPress | |
echo "βοΈ Configuring..." | |
wp config create --dbname=demo_db --dbuser=root --dbpass=password \ | |
--extra-php <<< "define('WP_DEBUG', true);" | |
wp core install --url=http://demo.local --title="$SITE_TITLE" \ | |
--admin_user=marcel --admin_password=mysecretpw123 --admin_email=demo@test.com | |
# Set permalinks | |
wp rewrite structure '/%postname%/' | |
# Install plugins | |
echo "π Installing plugins..." | |
wp plugin install woocommerce --activate | |
wp plugin install wordpress-seo --activate | |
# Install Storefront theme | |
echo "π¨ Installing theme..." | |
wp theme install storefront --activate | |
echo "" | |
echo "β Done! Site: $SITE_TITLE" | |
echo "π URL: http://demo.local" | |
echo "π€ Admin: marcel / mysecretpw123" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment