LoginSignup
5
3

More than 3 years have passed since last update.

よく使う WP-CLI コマンド

Last updated at Posted at 2017-10-05

コマンド中の [] 内は任意の値。 [] は実際には入力しない。

置換(サイト引っ越し時など)

wp search-replace [old] [new]

ディレクトリ移動

該当のプラグインディレクトリに移動( [] は不要 )

$ cd $(wp plugin path --dir [xxxx])

// ExUnitの場合
$ cd $(wp plugin path --dir vk-all-in-one-expansion-unit)
// BillVektor
$ cd $(wp theme path --dir bill-vektor)
// vws
$ cd $(wp theme path --dir lightning)
// vws
$ cd $(wp theme path --dir lightning-pro-child-vws)

VCCWでPHPUnitを動かすためにインストールする

$ bash bin/install-wp-tests.sh wordpress_test root 'wordpress' localhost latest

※ プラグインやテーマの bin ディレクトリに install-wp-tests.sh がある前提

テーマ・プラグイン

プラグインの作成

$ wp scaffold plugin sample

プラグインの有効化

$ wp plugin activate my-plugin

ユーザー関連

ユーザーリストを表示

$ wp user list

権限を指定してユーザーを表示

$ wp user list --role=administrator

ユーザーを削除

# wp user delete 7 --reassign=1

※ reassign は投稿を引き継ぐユーザーのID

ユーザーを追加

$ wp user create admin admin@example.com --role=administrator --user_pass=admin

ユーザーパスワードのアップデート

$ wp user update 1 --user_pass=[xxxx]

ユーザー権限

ユーザーロールをリセット

$ wp role reset administrator editor author

オプション値の編集・削除

// オプション値 xxxx を削除
$ wp option delete xxxx
// オプション値を変更
$ wp option update blogname "Random blog name"
5
3
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
5
3