Skip to content

Instantly share code, notes, and snippets.

@AtsushiA
Forked from shimakyohsuke/init.sh
Last active September 13, 2025 07:07
Show Gist options
  • Select an option

  • Save AtsushiA/1d3093eb9563dfc812a1f967fed854c2 to your computer and use it in GitHub Desktop.

Select an option

Save AtsushiA/1d3093eb9563dfc812a1f967fed854c2 to your computer and use it in GitHub Desktop.
Local で立ち上げ後に実効するやつ
#!/bin/bash
shopt -s expand_aliases
## 日本語化
wp core language install ja
wp core language activate ja
## いろいろなプラグインをインストール
echo "いろいろなプラグインをインストールしますか? [Y/N]"
read ANSWER1 < /dev/tty
case $ANSWER1 in
"" | "Y" | "y" | "yes" | "Yes" | "YES" )
wp plugin install \
wp-multibyte-patch \
hello-dolly \
--activate
;;
"N" | "n" | "no" | "No" | "NO" )
echo "プラグインのインストールをスキップしました。"
;;
* ) echo "plugin install Done!";;
esac
## テストデータのインポート
echo "テストデータインポートしますか? [Y/N]"
read ANSWER2 < /dev/tty
case $ANSWER2 in
"" | "Y" | "y" | "yes" | "Yes" | "YES" )
wp post delete 1 --force
wget https://raw.githubusercontent.com/wpaccessibility/a11y-theme-unit-test/refs/heads/master/a11y-theme-unit-test-data.xml
wp plugin install wordpress-importer --activate
wp import a11y-theme-unit-test-data.xml --authors=create
rm a11y-theme-unit-test-data.xml
## フロントページの設定
wp option update show_on_front page
FRONT_PAGE_ID=$(wp post list --post_type=page --fields=ID,post_title | grep "Front Page$" | awk '{print $1}')
wp option update page_on_front $FRONT_PAGE_ID
BLOG_PAGE_ID=$(wp post list --post_type=page --fields=ID,post_title | grep "Blog$" | awk '{print $1}')
;;
"N" | "n" | "no" | "No" | "NO" )
echo "テストデータのインポートをスキップしました。"
;;
* ) echo "theme unit test inport Done!";;
esac
## オプション
wp option update timezone_string 'Asia/Tokyo'
wp option update date_format 'Y年n月j日'
wp option update time_format 'H:i'
wp option update start_of_week 0
## プラグインとテーマのアップデート
wp plugin update-all
wp theme update-all
## 翻訳ファイルのアップデート
wp language core update
wp language plugin update --all
wp language theme update --all
## キャッシュのクリア
wp cache flush
## Status
echo "========== WordPress Status =========="
echo "Core Version : $(wp core version)"
echo "Site URL : $(wp option get siteurl)"
echo "========== Plugin Status =========="
wp plugin status
echo "========== Theme Status =========="
wp theme status
open $(wp option get siteurl)/wp-admin/
@AtsushiA
Copy link
Author

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