Skip to content

Instantly share code, notes, and snippets.

@meredevelopment
Last active April 11, 2016 14:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meredevelopment/11b6d3b2ef626f72e6bb14bf26b321ca to your computer and use it in GitHub Desktop.
Save meredevelopment/11b6d3b2ef626f72e6bb14bf26b321ca to your computer and use it in GitHub Desktop.
WP-CLI local dev installer snippet
#!/bin/bash
# Requires WP-CLI. Assumes WP-CLI is in your $PATH.
# Set the default LOC, TITLE, EMAIL, USER & PASSWORD as you like.
# Set the DB user and pass (line 11) to a user that has permissions to create DBs.
# run with ./installwp.sh in most cases.
read -p "Locale? (en_GB): " -e LOC
[ -z "${LOC}" ] && LOC='en_GB'
wp core download --locale=$LOC
read -p "DB Name?: " -e DBNAME
wp core config --dbname=$DBNAME --dbuser=[user] --dbpass=[pass]
wp db create
read -p "URL?: " -e URL
read -p "Title?: " -e TITLE
#[ -z "${TITLE}" ] && TITLE='Test Site'
read -p "Admin email?: " -e ADEMAIL
[ -z "${ADEMAIL}" ] && ADEMAIL='you@yourdomain.com'
read -p "Admin username?: " -e ADUSERNAME
[ -z "${ADUSERNAME}" ] && ADUSERNAME='defaultusername'
read -p "Admin password?: " -e ADPASSWORD
[ -z "${ADPASSWORD}" ] && ADPASSWORD='defaultpassword'
wp core install --url=$URL --title="$TITLE" --admin_email=$ADEMAIL --admin_user=$ADUSERNAME --admin_password=$ADPASSWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment