VCCW 設置
wp scaffold vccw wordpress.dev --lang=ja
追記:パッケージを導入しないといけませんでした。
https://goo.gl/hxmC9h
本体バージョン確認
wp core version --extra
コアアップデート
wp core update
オプション指定(日本語)
wp core update --locale=ja
コアダウングレード
wp core update --version=4.6.1 --force --locale=ja
DBアップデート
wp core update-db
DBテーブル確認
wp db size --tables
site_url home 確認
wp option get siteurl && wp option get home
db置換[追記:20171109]
wp search-replace --dry-run --skip-columns=guid 'example_before.dev' 'example_after.dev'
※どのような場合においてもGUIDは変更してはいけない。
GUID についての重要事項
db export 圧縮
wp db export local_xxx.sql
wp db export - | gzip -c > tmp/local_xxxxx.sql.gz
※ファイルサイズが大きいときに圧縮をして。サーバーの転送の最大値が決まっているときとか
WP-CLIで知っておいて欲しい便利な機能
upload_pathの確認
wp option get upload_path && wp option get upload_url_path
※昔制作したディレクトリを変えてあるサイトで何故かupload_pathが変更されているサイトがあってはまった。ファイルがアップできないときに確認。
pluginステータス確認
wp plugin status
plugin アップデート
wp plugin update --all
wp plugin update plugin_name plugin_name2
ユーザー確認
wp user list
ユーザーのパスワード変更
wp user update [user_ID] --user_pass=marypass
投稿を追加する
wp post create --post_type=page --post_title='A future post' --post_status=future --post_date='2020-12-01 07:00:00'
wp post generate --count=100 --post_type=post --post_status=publish --post_author=lafcre8
投稿を削除する
投稿のリストを表示する
wp post list --post_type=page
- 投稿リストから削除
wp post delete ID
- 投稿データの編集
wp post update ID --post_name=hogehoge
termを追加する
wp term create [taxonomy] "テスト" --slug=test --parent=3
termを削除する
wp term delete [taxonomy] test --by=slug
taxonomyのリスト
wp taxonomy list
+-----------------+------------------------+-------------+----------------+---------------+--------------+--------+
| name | label | description | object_type | show_tagcloud | hierarchical | public |
+-----------------+------------------------+-------------+----------------+---------------+--------------+--------+
| category | カテゴリー | | post | 1 | 1 | 1 |
| post_tag | タグ | | post | 1 | | 1 |
| nav_menu | ナビゲーションメニュー | | nav_menu_item | | | |
| link_category | リンクカテゴリー | | link | 1 | | |
| post_format | フォーマット | | post | | | 1 |
+-----------------+------------------------+-------------+----------------+---------------+--------------+--------+
termのリスト
wp term list [taxonomy]
+---------+------------------+--------------+---------------+-------------+--------+-------+
| term_id | term_taxonomy_id | name | slug | description | parent | count |
+---------+------------------+--------------+---------------+-------------+--------+-------+
| 6 | 6 | テスト | test | | 0 | 0 |
| 9 | 9 | テスト2 | test2 | | 0 | 0 |
| 4 | 4 | テスト3 | test3 | | 0 | 0 |
+---------+------------------+--------------+---------------+-------------+--------+-------+
言語設定を変更する
日本語をダウンロード
wp core language install ja
選択する
wp core language activate ja
front page 切り替え
Is it possible to set up "home" page as front page instead of "blog page" with wp-cli ?
wp option update page_on_front 2
見つけたけど思うように動かなくて保留
パーマリンク設定を変更する
設定の確認
wp option get permalink_structure
変更
wp rewrite structure /archives/%post_id%
パーマリンクの書換
※カスタム投稿ポストを追加したときなど・・・
※htaccessも設置したいときにはオプションで[--hard]指定 [追記:20171005]
wp rewrite flush --hard
wp cli update
wp cli version
wp cli check-update
sudo wp cli update --allow-root
wp-cli package
リビジョンを良い感じに操作できるという(まだ試してるとこ)パッケージ
Revisions CLI
https://github.com/trepmal/wp-revisions-cli
# command
wp revisions clean [<keep>]