LoginSignup
5
3

More than 5 years have passed since last update.

wp-cli コマンド一覧(随時追記)

Last updated at Posted at 2017-08-02

概要

ついつい忘れがちなので自分で使ったことあるコマンドを随時追記していきます。

※全てのコマンドをまとめているわけではないので、当記事に書いていないコマンドについては公式ドキュメントをご覧ください。
公式ドキュメント

共通引数

--path

実行ディレクトリの指定。主にインストール先やインストールディレクトリを指定します。
省略した場合はデフォルトとしてカレント指定となります。

コマンド

wp core

wordpress本体のダウンロードやインストール、アップデート等を行うコマンド

download

Wordpress本体をインストール及び展開します。
Document

引数 概要
local 言語指定
version バージョン指定
force 上書き
command
wp core download \
--locale=ja \
--force \
--version=4.4 \
--path=/var/www/html/wordpress

config

Wordpressの設定ファイル(wp-config.php)を作成します。

引数 概要
dbname DB名
dbuser DBユーザー
dbpass DBユーザーパスワード
dbhost DBホスト
dbprefix DBテーブル接頭辞
command
wp core config \
--dbname=sample_db \
--dbuser=db_user \
--dbpass=1234 \
--dbhost=db_host \
--dbprefix=sample_ \
--path=/var/www/html/wordpress

install

Wordpressの初期設定を行います。
Document

引数 概要
title サイト名
admin_user サイト管理ユーザー
admin_password サイト管理ユーザーパスワード
admin_email サイト管理ユーザーメールアドレス
url サイトURL
command
wp core install \
--title=サンプルサイト \
--admin_user=wp_admin \
--admin_password=1234 \
--admin_email=admin@example.com \
--url=$http://sample \
--path=/var/www/html/wordpress

wp db

Databaseを操作するコマンド

create

wp-config.phpのDB接続情報を元にDBを作成します。
Document

command
wp db create 

wp term

カテゴリ操作関連のコマンド

create

カテゴリを新規作成します。
Document

引数 概要
category カテゴリ名
slug スラッグ
description 概要
command
wp term create \
category Sample \
--slug=sample \
--description="サンプル" 

wp rewrite

リライト操作関連のコマンド

structure

パーマリンクの定義を更新します。
Document

command
wp rewrite structure \
'/%category%/%year%/%monthnum%/%postname%/index.html' 

wp plugin

プラグイン操作関連のコマンド

install

プラグインをインストールします。
Document

command
wp plugin install \
staticpress 

active

プラグインを有効化します。
Document

command
wp plugin activate \
staticpress 

wp theme

テーマ操作関連のコマンド

install

プラグインをインストールします。
Document

command
wp theme install \
twentyseventeen.zip

active

プラグインを有効化します。
Document

command
wp theme activate \
twentyseventeen 
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