Skip to content

Instantly share code, notes, and snippets.

@bradsiefert
Created March 22, 2018 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradsiefert/ccfbfea7d7ea657d69d43f26ec2eab82 to your computer and use it in GitHub Desktop.
Save bradsiefert/ccfbfea7d7ea657d69d43f26ec2eab82 to your computer and use it in GitHub Desktop.
Create New Wordpress install shell script (using Valet)
# !/bin/sh
# A shell script to create a new WordPress site using Valet to develop locally.
echo "What do you want your site's folder to be named? No Spaces, only choose lowercase letters."
read wp_site_name
mkdir $wp_site_name
cd $wp_site_name
echo "Launching a new Valet site..."
valet park
valet secure
# We will need a database for that WordPress site.
echo "CREATE DATABASE $wp_site_name" | mysql -uroot
echo "Installing WordPress..."
wp core download
wp core config --dbname=$wp_site_name --dbuser=root --dbpass='' --extra-php <<PHP
PHP
wp core install --url=$wp_site_name.dev --title=$wp_site_name --admin_user=admin --admin_password=password --admin_email=admin@email.com
echo "Generate some posts..."
curl http://loripsum.net/api/5 | wp post generate --post_content --count=10
echo "Success! Your new site is ready!"
open http://$wp_site_name.dev/wp-admin/

Quick Create a new Wordpress install & setup Valet

This will setup a local wordpress install and setup Laravel's Valet to develop locally.

Requirements:

Notes

  • Creates a Wordpress install in the directory you run the file from.
  • Creates a new user login with user: admin, password: password. Probably a good idea to change those.

Giving credit where credit is due: This script is a similified and tweaked version of jeherve's script: https://jeremy.hu/dev-environment-laravel-valet-wp-cli/

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