WP-CLI
WP-CLI リファレンス (Pro)
シェルからのバックアップ、復元、インポート、インストーラーの展開、災害復旧、ステージングを自動化します。 Multisite Migrate 管理 UI と完全に同等 - ヘルプを除くすべてのコマンドに Pro ライセンスが必要です。
要件
- WP-CLI installed on the server (or SSH session).
- Multisite Migrate plugin active; run commands from the WordPress root (
wpmust load the site). - プロライセンス — every command except
helprequires Multisite Migrate Pro. Plus and Free licenses cannot use WP-CLI. - WordPress capability:
manage_options(single site) ormanage_network(multisite network tasks).
はじめに
wp multisite-migrate help
wp multisite-migrate help --topic=restore
wp multisite-migrate backup --help
wp multisite-migrate list help prints a full command tree, capability notes, and copy-paste examples. Use --topic=backup|restore|import|jobs|installer|recovery|staging|caps to filter sections. Per-command flags are documented with native WP-CLI --help.
コマンドツリー
| コマンド | 目的 |
|---|---|
backup | バックアップ ジョブを実行します (ローカルおよびオプションのクラウド アップロード) |
restore <job-id> | トポロジ オプションを使用した同一サーバーの復元または URL 移行 |
import | ディスク、URL、またはクラウドからアーカイブを登録します。オプションの連鎖リストア |
list | 完了したバックアップまたは復元ジョブをリストする |
status <job-id> | ジョブの進行状況、パーセント、メタデータ |
cancel <job-id> | 実行中のジョブをキャンセルする |
delete <job-id> | ジョブレコードとローカルアーカイブが存在する場合は削除します |
prefetch <job-id> | 復元前にクラウドのみのバックアップをダウンロードする |
manifest <job-id> | アーカイブ マニフェスト JSON を印刷します |
migration-preview <job-id> | 移行用の URL とテーブル マッピングをプレビューする |
info | プラグインのバージョン、エンジン、ライセンスの概要 |
health | PHP 拡張機能、ディスク容量、ストレージ パス |
cleanup | 一時インポート ファイルとワーカー ファイルを削除する |
prune | 古いローカル バックアップに保持ポリシーを適用する |
installer | バックアップの横にインストーラーを展開するか、ブートストラップ PHP をダウンロードします |
recovery | 災害復旧ポイントを設定、起動、またはリセットする |
list-remote <channel> | リモート バックアップの一覧表示 (gdrive、s3、sftp、dropbox) |
staging | ステージング サブサイトを作成、削除、またはプッシュする |
help | このリファレンスを端末で印刷します |
バックアップ
wp multisite-migrate backup
wp multisite-migrate backup --upload --destination=gdrive
wp multisite-migrate backup --scope=network --profile=full
wp multisite-migrate backup --scope=subsite --profile=db --incremental Common flags: --upload, --destination=local|gdrive|s3|sftp|ftp|dropbox, --scope=network|subsite, --profile=full|db|files|media|plugins|themes|custom, --incremental, --quiet.
クラウドアップロードには、Plus/Pro クラウドストレージが設定されている必要があります。 クラウドストレージ。ネットワーク管理者は、Free+ のネットワーク スコープを利用できます。 subsite-admin ネットワーク ジョブは引き続きシート/機能ルールに従います。
復元
wp multisite-migrate restore 42 --yes
wp multisite-migrate restore 42 --mode=db --no-safety-snapshot
wp multisite-migrate restore 42 --migration --old-url=https://old.example --new-url=https://new.example --yes トポロジーフラグは管理画面の マルチサイト復元 に対応します:
--topology-import=subsite_on_network+--topology-target-url=…— サブサイトバックアップを既存ネットワークへ--topology-import=network_to_subsite+--topology-target-blog-id=…— ネットワークバックアップをサブサイト枠へ--prefix-policy=keep_source|remap_wp,--blog-domains=<json>,--passphrase=…(.venc用)- 共有ユーザーのマージ(2 つのネットワーク着地モードでは既定でオン):
--user-merge/--no-user-merge,--uid-fields=_customer_user,_other_meta,--reset-imported-passwords,--send-password-reset-email
wp multisite-migrate restore 42 --topology-import=subsite_on_network --topology-target-url=https://network.example/site/ --user-merge --uid-fields=_customer_user --yes 長い復元では進捗バーが表示されます。セーフティスナップショットは --no-safety-snapshot が無い限り実行されます。上書き確認をスキップするには --yes を使います。
インポート
wp multisite-migrate import /var/backups/site.zip
wp multisite-migrate import --url=https://cdn.example/backup.zip
wp multisite-migrate import --from=gdrive --remote-id=FILE_ID --name=site.zip
wp multisite-migrate import /path/archive.zip --restore --via-worker --yes Remote URL and cloud channels require Pro (CAP_REMOTE_IMPORT). Chain --restore to start restore immediately; add --via-worker for in-plugin restore instead of installer deploy.
ジョブ管理
wp multisite-migrate list --type=backup --format=table --limit=50
wp multisite-migrate status 42
wp multisite-migrate cancel 42
wp multisite-migrate delete 42
wp multisite-migrate manifest 42
wp multisite-migrate migration-preview 42 list supports --format=table|json|csv. Subsite admins on multisite see only their scope unless they have network cap.
インストーラーと空のサーバー
wp multisite-migrate installer 42
wp multisite-migrate installer 42 --bridge
wp multisite-migrate installer ダウンロード --type=php
wp multisite-migrate installer ダウンロード 42 --type=php 同じウィザードをデプロイします インポート → インストーラーを開く. --bridge uses wp-admin MU-plugin proxy when archives are protected. ダウンロード writes bootstrap PHP beside your shell (Pro CAP_INSTALLER).
See also 空サーバー移行.
災害復旧
wp multisite-migrate recovery set --job-id=42
wp multisite-migrate recovery status
wp multisite-migrate recovery launch
wp multisite-migrate recovery reset 一致 バックアップ → リカバリ: in-place overwrite from a pinned full backup with WordPress core. Disable site-wide with define('MM_DISALLOW_RECOVERY', true); in wp-config.php.
ステージング
wp multisite-migrate staging create --slug=staging --title="Staging"
wp multisite-migrate staging delete --slug=staging
wp multisite-migrate staging push --job-id=42 Requires Pro CAP_STAGING. Same flows as リストアガイドの Staging.
メンテナンス
wp multisite-migrate info
wp multisite-migrate health
wp multisite-migrate cleanup
wp multisite-migrate prune
wp multisite-migrate list-remote gdrive ライセンス機能
Pro ゲートの後、個々のコマンドには二次的な機能 (管理 UI と同じ) が必要になる場合があります。
| 能力 | CLI の例 |
|---|---|
CAP_CLI | All commands except help — Pro only |
CAP_CLOUD | backup --upload, prefetch, list-remote |
CAP_REMOTE_IMPORT | import --url, import --from=* |
CAP_MULTISITE | マルチサイト機能ゲートを必要とするネットワーク全体の管理フロー (CLI ヘルプを参照) |
CAP_INSTALLER | installer ダウンロード |
CAP_STAGING | staging * |
CAP_NETWORK_SPLIT | split-network, split-status, split-cancel, split-resume, restore --topology-import=extract_site_standalone |
シナリオレシピ
| シナリオ | コマンド |
|---|---|
| サブサイト → スタンドアロン移行 | wp multisite-migrate restore <id> --migration --old-url=… --new-url=… --yes |
| 分割ネットワーク → サイトごとのアーカイブ | wp multisite-migrate split-network --yes then split-status — see ネットワーク分割ガイド |
| 失敗した分割を再開する | wp multisite-migrate split-resume --yes then split-status |
| ネットワーク アーカイブ → 1 つのサイト スタンドアロン | wp multisite-migrate restore <id> --migration --topology-import=extract_site_standalone --source-blog-id=N --old-url=… --new-url=… --yes then migration-verify |
| 残った URL を確認する | wp multisite-migrate migration-verify --old-url=… |
| 検索置換を確認しました | wp multisite-migrate search-replace --old=… --new=… --yes |
| サブサイト → 既存のネットワーク (ユーザーを統合) | wp multisite-migrate restore <id> --topology-import=subsite_on_network --topology-target-url=… --user-merge --yes |
| ネットワーク → サブサイト スロット (ユーザーをマージ) | wp multisite-migrate restore <id> --topology-import=network_to_subsite --topology-target-blog-id=… --user-merge --yes |
| ユーザーマージを行わないネットワークインポート | wp multisite-migrate restore <id> --topology-import=subsite_on_network --topology-target-url=… --no-user-merge --yes |
| ユーザーを結合 + パスワードをリセット | wp multisite-migrate restore <id> --topology-import=subsite_on_network --topology-target-url=… --user-merge --reset-imported-passwords --send-password-reset-email --yes |
| インポートしてからインストーラー | wp multisite-migrate import /path/backup.zip --restore |
| インポートしてからプラグイン内で復元 | wp multisite-migrate import /path/backup.zip --restore --via-worker --yes |
| クラウド専用バックアップ→復元 | wp multisite-migrate prefetch <id> then wp multisite-migrate restore <id> --yes |
| インストーラーのデプロイ (ブリッジ) | wp multisite-migrate installer <id> --bridge |
| 災害復旧ポイント | wp multisite-migrate recovery set --job-id=<id> then recovery launch |
グローバルフラグ
--quiet— suppress progress messages on long jobs--porcelain— machine-readable progress lines
関連ガイド
WP-CLI よくある質問
シェルの自動化には Pro が必要です。ライブ コマンド リストについては、サーバー上のヘルプを使用してください。
WP-CLI にはどのライセンスが必要ですか?
プロ。 Free および Plus では、Multisite Migrate WP-CLI コマンドを実行できません (ヘルプが表示される場合を除く)。
Wp コマンドはどこで実行すればよいですか?
WordPress ルートから WP-CLI がサイトをロードします。 Multisite Migrate プラグインがアクティブである必要があります。
CLI を使用してスケジュールを自動化できますか?
Pro でははい — バックアップ、復元、インポート、インストーラー、リカバリ、およびステージングのコマンドは管理 UI を反映します。上記のレシピセクションを参照してください。
WP-CLI 経由でネットワークに復元するときにユーザーを結合するにはどうすればよいですか?
--topology-import=subsite_on_network または network_to_subsite を使用します。共有ユーザーの結合はデフォルトでオンになっています。 --no-user-merge を渡してスキップするか、必要に応じて --uid-fields と --reset-imported-passwords を渡します。上記の復元セクションとレシピを参照してください。
WP-CLI のみを使用する場合、14 日の返金は適用されますか?
はい。新しい Plus または Pro の購入には、管理 UI と WP-CLI のどちらを好むかに関係なく、14 日間の返金保証が含まれます。