Skip to content

Instantly share code, notes, and snippets.

@nyawach
Last active February 8, 2018 04:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyawach/d11159b391fe3e481d25447878abc210 to your computer and use it in GitHub Desktop.
Save nyawach/d11159b391fe3e481d25447878abc210 to your computer and use it in GitHub Desktop.
WordPress開発環境作るコマンド
#!/bin/sh
# 設定 ############
# DB構築に必要な設定
DB_NAME=""
DB_USER="root"
DB_PASS=""
DB_HOST="127.0.0.1"
DB_PREFIX="wp_"
# サイトの設定(後で管理画面にて変更可)
SITE_URL="http://example.com/"
SITE_TITLE="TEST"
# 管理者設定
ADMIN_USER="admin"
ADMIN_PASSWORD="password"
ADMIN_EMAIL="test@example.com"
# 入れときたいプラグイン・テーマの設定
PLUGINS=("")
THEME=""
# ############
# WordPress本体のダウンロード(日本語版)
wp core download --locale=ja
# wp-config.phpの設定
wp core config \
--dbname=${DB_NAME} \
--dbuser=${DB_USER} \
--dbpass=${DB_PASS} \
--dbhost=${DB_HOST} \
--dbprefix=${DB_PREFIX}
# WordPress用DBの作成(MySQLの起動)
wp db create
# WordPressの初期化
wp core install \
--url=${SITE_URL} \
--title=${SITE_TITLE} \
--admin_user=${ADMIN_USER} \
--admin_password=${ADMIN_PASSWORD} \
--admin_email=${ADMIN_EMAIL}
# Hello Dollyプラグインは容赦なく消す
wp plugin uninstall hello
# プラグインのインストール
for plugin in ${PLUGINS[@]}
do
wp plugin install $plugin --activate
done
# テーマのインストール・有効化(入っていたら有効化だけ実行される)
if [ ! ${THEME} = "" ]; then
wp theme install ${THEME} --activate
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment