Skip to content

Instantly share code, notes, and snippets.

@eirichmond
Created February 6, 2020 15:06
Show Gist options
  • Save eirichmond/51ae754eba590b4d902ef66b5a32baf6 to your computer and use it in GitHub Desktop.
Save eirichmond/51ae754eba590b4d902ef66b5a32baf6 to your computer and use it in GitHub Desktop.
WordPress Install with wp-cli
#!/bin/bash
# download the core
wp core download --locale=en_GB
# setup the wp-config
read -p "DB Name?: " -e DBNAME
read -p "DB Password?: " -e DBPASS
read -p "DB Prefix?: " -e DBPREFIX
wp config create --dbname=$DBNAME --dbuser=root --dbpass=$DBPASS --dbprefix=$DBPREFIX --extra-php <<PHP
define( 'WP_DEBUG', true );
define( 'DISALLOW_FILE_EDIT', true);
PHP
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='[email protected]'
read -p "Admin username?: " -e ADUSERNAME
[ -z "${ADUSERNAME}" ] && ADUSERNAME='elliottrichmond'
read -p "Admin password?: " -e ADPASSWORD
[ -z "${ADPASSWORD}" ] && ADPASSWORD='password'
wp core install --url=$URL --title="$TITLE" --admin_email=$ADEMAIL --admin_user=$ADUSERNAME --admin_password=$ADPASSWORD
wp option update permalink_structure '/%postname%/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment