- @param --dbname:
- Used to set the database name.
- Sets param of same name for
wp core config
command from WP CLI - Leave blank to be prompted for input
- @param --dbuser:
- Used to set the database user.
- Sets param of same name for
wp core config
command from WP CLI - Leave blank to be prompted for input
- @param --dbpass:
- Used to set the database user's password.
- Sets param of same name for
wp core config
command from WP CLI - Leave blank to be prompted for input
- @param --url:
- The address of the new site.
- Sets param of same name for
wp core install
command from WP CLI - Leave blank to be prompted for input
- @param --title:
- The title of the new site.
- Sets param of same name for
wp core install
command from WP CLI - Leave blank to be prompted for input
- @param --admin_user:
- The name of the admin user.
- Sets param of same name for
wp core install
command from WP CLI - Leave blank to be prompted for input
- @param --admin_password:
- The password for the admin user.
- Sets param of same name for
wp core install
command from WP CLI - Leave blank to be prompted for input
- @param --admin_email:
- The email address for the admin user.
- Sets param of same name for
wp core install
command from WP CLI - Leave blank to be prompted for input
- @param --db_exists:
- If param exists the command
wp db create
will be skipped
- If param exists the command
- @param --clear_dir:
- If param exists the command
rm -rf *
will be called. Deleting all the contents of the current folder. Carefull!!!
- If param exists the command
Firstly Install the WP CLI as described at http://wp-cli.org/.
Ensure that you can run the CLI by typing:
wp --info
If that works you can proceed. Download the shell file from this gist into the dir you'd like to use. Make the shell file executable by typing.
chmod +x NewWordpress.sh
Then Run a command like this:
./NewWordpress.sh --dbname 'avengers_assemble' --dbuser 'NickFury' --url 'http://localhost/AvengersAssemble' --title 'Avengers Assemble' --admin_user 'OneEyedNick' --admin_email '[email protected]'
That sets all params except --admin_password
and --dbpass
Nick Fury keeps his passwords secret.
Like a boss.
If you wanna really run things like a boss then toss the script in a directory of your choosing and alter your bash profile:
sudo nano ~/.bash_profile
and add the following text:
alias newwp="/path/to/NewWordpress.sh"
then logout of bash or type source ~/.bash_profile
. after that you can run this command by just typing newwp
and following the prompts or by editing the example above like so:
newwp --dbname 'avengers_assemble' --dbuser 'NickFury' --url 'http://localhost/AvengersAssemble' --title 'Avengers Assemble' --admin_user 'OneEyedNick' --admin_email '[email protected]'