LoginSignup
14
15

More than 5 years have passed since last update.

WP CLIを利用して、コア、プラグイン、テーマ、翻訳ファイルをアップデートする

Last updated at Posted at 2016-08-17

WP CLIのアップデートをまず行う。(古いバージョンだとコアを最新版にアップデートした後、正しくWP CLIが動かない可能性があるため)

WP CLIバージョンの確認

$ wp cli version
WP-CLI 0.24.1

WP CLIアップデート

wp cli update

wp cliのアップデートが終わったら、今度はそれぞれのWordPressのサイトにおいて、アップデートを行う。アップデート前にサイトのバックアップをしておく

WordPressが利用しているDBのエクスポート(バックアップ用)

$ wp db export hogehoge.sql

コア、プラグイン全て、テーマ全て、翻訳ファイル をアップデートするワンライナー(一行のコメント)

wp core update && wp plugin update --all && wp theme update --all && wp core language update

おまけ よく使うWP CLIのコマンド

DB内のドメインを置換した状態でエクスポート(元のDBはそのまま残る。本番などドメインの異なる環境への移行用)

$ wp search-replace '元のドメイン' '置換後のドメイン' --export=hogehoge.sql

※ ドメインはhttpから記載、最後のスラッシュは無し

コアファイルの改竄チェック

$ wp core verify-checksums

以下の内容が表示されれば問題なし

Success: WordPress install verifies against checksums.

Git管理している場合のpushまで

git reset --hard HEAD && wp core update && wp plugin update --all && wp theme update --all && wp core language update && git add -A && git commit -m "update all" && git push origin master
14
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
15