Skip to content

WP-CLI export/import commands not registered: 'mu-migration' is not a registered wp command #1006

@superdav42

Description

@superdav42

Bug

The wp mu-migration export and wp mu-migration import WP-CLI commands are not registered, so users cannot export/import via the CLI:

$ wp mu-migration export all /tmp/export.zip --blog_id=2 --url=http://wordpress.local:8080
Error: 'mu-migration' is not a registered wp command.

Root Cause

WP-CLI command registration happens at the bottom of each mu-migration class file (e.g., \WP_CLI::add_command('mu-migration export', ...) at the end of class-mu-migration-export.php). These files are only loaded via Site_Exporter::load_dependencies(), which is gated behind the non-existent vendor/autoload.php check (see #1004).

Even if #1004 is fixed, the command registration lines execute at file-include time, which only happens when handle_site_export() or handle_site_import() is called — too late for WP-CLI's command discovery.

Expected

Users should be able to run:

wp mu-migration export all /tmp/export.zip --blog_id=2
wp mu-migration import all /tmp/export.zip --new_url=http://newsite.example.com

Or ideally, proper Ultimate Multisite CLI commands:

wp wu export-site 2 /tmp/export.zip --uploads --themes --plugins
wp wu import-site /tmp/export.zip --new-url=http://newsite.example.com

Suggested Fix

  1. Register the mu-migration dependencies and CLI commands early in the plugin lifecycle (in init() or load_extra_components()) so WP-CLI discovers them at boot time
  2. Consider adding proper wp wu export-site and wp wu import-site commands as wrappers that call the underlying mu-migration commands — consistent with the wu_ namespace convention

Files to modify

  • EDIT: inc/class-wp-ultimo.php or inc/site-exporter/class-site-exporter.php — load mu-migration commands during plugin init when WP-CLI is active
  • NEW: inc/apis/class-cli-export-import.php (optional) — proper wp wu export-site / wp wu import-site wrappers

Severity

High — CLI export/import is completely non-functional.


aidevops.sh v3.13.11 plugin for OpenCode v1.3.17 with claude-opus-4-6 spent 5m and 12,337 tokens on this as a headless worker.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingorigin:interactiveCreated by interactive user sessionstatus:in-progressWorker actively running

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions