Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A shell function to create a directory, install WordPress, configure SSL via Laravel Valet, an launch the site in Chrome
# Install a new WP site.
# Usage: wpinstall <sitename>
function wpinstall() {
# Make the directory in your local web root
mkdir ~/Sites/www/$@;
cd ~/Sites/www/$@;
# Download, config, and install WordPress using <sitename> for the database, URL, and site title
# Note: You'll need to configure your wp-cli defaults for core config and core install in a wp-cli.yml file
wp core download;
wp core config --dbname=$@;
wp db create;
wp core install --url=https://$@.test --title=$( tr '[A-Z]' '[a-z]' <<< $@ );
# Configure SSL for the site with Laravel Valet
valet secure $@;
# Open the site in Chrome,
open -a "Google Chrome" https://$@.test/wp-admin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment