Created
December 21, 2019 08:11
-
-
Save WPprodigy/2ceeeaf631a56ad9c3dd4498813f227e to your computer and use it in GitHub Desktop.
WP local site creation script. Made for use with https://laravel.com/docs/6.x/valet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: wp-create sitename | |
if [ $# -eq 0 ]; then | |
echo "Need to provide the directory name to be created." | |
exit 1 | |
fi | |
# set up new folder to house the WP install | |
cd ~/development/valet-sites | |
mkdir $1 && cd $1 | |
# dowload wordpress and setup to use new database | |
wp core download | |
wp config create --dbname=$1 --dbuser=root --dbpass='' | |
wp config set WP_DEBUG true --raw --type=constant | |
wp config set WP_DEBUG_DISPLAY false --raw --type=constant | |
wp config set WP_DEBUG_LOG true --raw --type=constant | |
wp config set SCRIPT_DEBUG false --raw --type=constant | |
wp config set JETPACK_DEV_DEBUG true --raw --type=constant | |
wp db create | |
wp core install --url=$1.test --title=$1 --admin_user=a [email protected] --admin_password=p | |
echo -e "Success: $1.test created." | |
# make https, will ask for a pw and restart the server | |
echo -e "Note: Enter your password so we can secure the site with a local SSL cert:" | |
valet secure $1 | |
# delete Hello Dolly & Akismet | |
wp plugin delete hello | |
wp plugin delete akismet | |
# install and activate Query Monitor | |
wp plugin install query-monitor && wp plugin activate query-monitor | |
# open the site in default browser | |
valet open $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also pairs well with
wp-remove
script below for deleting the sites :)