Skip to content

Instantly share code, notes, and snippets.

@andrewwoods
Last active August 29, 2015 14:25
Show Gist options
  • Save andrewwoods/013e5f09e73d1345c9a9 to your computer and use it in GitHub Desktop.
Save andrewwoods/013e5f09e73d1345c9a9 to your computer and use it in GitHub Desktop.
Install and Configure WordPress using WP-CLI
#
# wp_install - download wordpress, install, and configure it.
#
# $ wp_install <dirname>
#
function wp_install
{
wp core download --path=$1
cd $1
read -p 'name the database:' dbname
wp core config --dbname=$dbname --dbuser=root --dbpass=awoods --dbhost=localhost
wp db create
wp core install --prompt
}
@andrewwoods
Copy link
Author

Instead of using --prompt on wp core config, it's better UX to hard code the value for --dbuser --dbpass and --dbhost and just use bash to prompt for the --dbname. There are 11 prompts for wp core config! you shouldn't have to answer them every time.

A compromise would be to create bash prompts for the --dbname --dbpass and --dbhost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment