{ "name": "MU Migration", "slug": "mu-migration", "version": "0.5.1", "download_url": "https://gitea.mulligan.casa/wordpress/wp-updates/raw/branch/main/mu-migration/mu-migration-0.5.1.zip", "homepage": "https://gitea.mulligan.casa/wordpress/mu-migration", "requires": "6.1", "tested": "7.0", "requires_php": "8.1", "last_updated": "2026-10-04 03:15:32", "author": "Mike Mulligan", "author_homepage": "https://gitea.mulligan.casa/mmulligan", "tags": [ "multisite", "migration", "wp-cli", "export", "import" ], "sections": { "description": "
MU Migration adds a wp mu-migration command family to WP-CLI. It exports a site's tables, users, and optionally its plugins, themes and uploads into one zip package, then imports that package into a multisite network as a new or existing subsite, or into a single site. On import it rewrites the table prefix, remaps user ids into the network's shared users table, runs the URL and uploads-path search-replaces, and performs the housekeeping a moved site needs.
This is a maintained fork of MU-Migration, created by Nícholas André at 10up and archived on 2 March 2026. The fork runs on current PHP, ships as an ordinary plugin with self-hosted updates, and plans every run before it does anything.
\nCommands
\nwp mu-migration export all <zip> exports tables, users and meta data, plus --plugins, --themes and --uploads when asked. The <zip> is required.wp mu-migration export tables <file> and export users <file> export one piece at a time; the <file> is required.--blog-id, or without it the site WP-CLI runs against (--url, or the main site).wp mu-migration import all <zip> imports a package: into a new subsite at --new-url (or the package's own address with --same-url), or over an existing site with --blog-id. --uid-fields and --uid-columns name the post-meta keys and the plugin table columns that hold user ids. --upload-collisions=keep or --upload-collisions=replace says what to do with a package upload already on the site with other content, which otherwise refuses the import. --installed-versions=keep or --installed-versions=replace says what to do with a requested plugin or theme installed at another version than the package's copy, which otherwise refuses it too. Each replace needs --backup-dir, and replacing a plugin or theme another site of the network runs needs --dangerously-allow-shared-code-replace.wp mu-migration import tables <file> --blog-id=<id> and import users <file> --blog-id=<id> --map-file=<map> import one piece at a time; --map-file is required and names where the old-id to new-id map is written.wp mu-migration posts update_author <map> --blog-id=<id> remaps post authors, comment authors, --uid-fields post meta and the --uid-columns columns (--uid-columns=em_events.event_owner) to the new user ids.wp mu-migration users update_passwords sets or resets passwords after a move.wp mu-migration info prints the tool's version.Plan, refuse, confirm, apply
\nEvery command first builds a plan by running its real logic against recording executors: reads are real, and every write becomes a plan step with its exact arguments. The dump is copied, rewritten and scanned inside a private work directory, and each search-replace runs as wp search-replace --dry-run --report so the plan carries real counts. The plan is printed before anything is applied.
--dry-run stops there and closes with Dry run: N steps planned; this tool wrote nothing outside its private work directory, which is removed when this run ends. The site's own code can still write: WP-CLI loads the site's theme and plugins, and an import into an existing site previews each search-replace in a child that loads the target site's theme and plugins, which may write as any request to the site would. The closing line, the step, a declined confirmation's Cancelled line and a refusal say so when a preview ran. Before a dry run on a site whose code writes when it loads, back up its tables or rehearse on a copy.Continue?. --yes skips the question and acknowledges nothing.--quiet, or when standard input is not an interactive terminal. A live --format=json run needs --yes.Acknowledgement flags
\n--allow-main-site: any write to the network's main site (or the only site of a single-site install), and every network-wide plugin activation.--dangerously-allow-drop-tables: a dump that drops a table that exists now.--dangerously-allow-table-changes: a dump that changes an existing table in place (REPLACE, ALTER, or INSERT without recreating it).--dangerously-allow-global-tables: widening the search-replaces to the network's users, usermeta, blogs, site and sitemeta tables.--allow-overwrite: writing an output file over an existing one.--dangerously-allow-role-overwrite: replacing the role of an existing user who already has one on the target site.--allow-password-reset-mail: mailing password-reset links, the tool's only outbound network call.--dangerously-allow-nested-url: a URL change whose new address is the old one plus a path (https://net.test to https://net.test/site3), which also rewrites every other address under the old one, links to sibling sites included.--dangerously-allow-shared-code-replace: --installed-versions=replace of a plugin or theme another site of the network runs (active there, network-active, or the parent of its theme). The new code runs on those sites too, and the run's undo cannot put them back; the refusal names them.Two more flags request behaviour that is off by default, and the confirmation lists them: --dangerously-allow-guid-rewrite (search-replaces otherwise always skip the guid column) and --dangerously-allow-database-redirects (dumps with USE, database-qualified names or a REFERENCES into another database are otherwise refused; allowing them prints a DANGER warning even under --quiet, because such statements can write outside the backed-up database).
Every flag is bare: a value or a --no- negation is refused. Former spellings, such as --blog_id or --allow-drop-tables, are refused with the name that replaced them.
Safety behaviour
\n<backup-dir>/mu-migration-backup-blog<id>-<timestamp>.sql, an owner-only (0600) file in an owner-only (0700) directory. --backup-dir must be absolute and outside the WordPress root. This backup does not cover network tables, users and memberships, uploads, plugin and theme directories or redirected databases: take a full backup first.wp db import - on standard input, where the database client stops at the first statement that fails. The import fails, naming the error and its line, when the client exits non-zero or prints an ERROR line. wp db import <file> carries on past a failed statement and exits 0.IF NOT EXISTS and never drops, and a table it writes with INSERT DELAYED (whose rows the server queues), are named in the plan as not counted.--skip-columns=guid. The URL is matched only as a whole host and path, the host in any case. --new-url and --old-url must start with http:// or https:// and a valid host, and may not hold %. The new URL's scheme is written into every http:// and https:// reference, plain, JSON-escaped or URL-encoded. Each reference is moved in its own form, the whole address (host, port and path) written in it; protocol-relative and bare references keep their form. An e-mail address at the old host is never rewritten, and a bare single-label host such as localhost is left alone. The uploads path moves in every form, and only in the site's own references. A read-only scan afterwards reports, per column, the values that still hold the old host.meta.json values, dump names, logins) is printed with its control characters as escapes.users.json, which carries every role a user holds on the exported site and every usermeta row that travels, byte for byte. Session tokens and application passwords never travel; the per-site keys WordPress itself writes are moved to the target site's prefix, and every other key keeps its name. A users.csv from a version before 0.5.0 is refused: re-export it.added_user_meta or updated_user_meta hook fires for them; the plugin's own user-data hooks still run. A value the database column cannot hold stops the run, naming the user, the key and the row; on a usermeta table that keeps no transactions (MyISAM), it also names the rows already written.--role-definitions=destination keeps the site's own definitions instead. The plan, the closing lines and the JSON run record (role_definitions) list, per role, the capabilities the merge adds and removes.--plugins and --themes. One already installed is compared with the package's copy by its Version header: the same version is left alone, and another, or one that cannot be read, refuses the import, naming both versions, unless --installed-versions=keep keeps the installed code or --installed-versions=replace moves it into --backup-dir and installs the package's. Plugin and theme code is shared by every site of a network: replacing code another site runs needs --dangerously-allow-shared-code-replace. The plugin and theme moves come first, before the site is created, the backup, the import and the URL passes. Uploads are merged: a file already there with the same content is skipped, and one with other content refuses the import unless --upload-collisions=keep keeps it or --upload-collisions=replace moves it into --backup-dir and places the package's. The undo and recovery lines put a replaced plugin, theme or upload back, remove the directories the run made for them in the backup directory, and say to reset PHP's opcode cache after a plugin or theme. A move renames only where a rename really moves the file, and otherwise copies it, keeping its mode and modification time. Uploads, plugins and themes get the modes WordPress gives them, whatever the umask.--format=json prints JSON Lines: a step record per step, a summary, a refused record when an acknowledgement is missing, and a final run record with the outcome, the backup path, the files written, the remap tallies, the upload collisions, the installed versions, the URL leftovers and the recovery or undo lines. A step record is printed before anything is applied, so its performed is true only for what the plan build itself did; the live outcome is the run record.A run that completed prints, last, the commands that undo it: the same lines a failure would print. Recovery after a failure is printed guidance, never executed. Its restore of the backup is wp db import - < '<backup>', run from a shell, so the restore also stops at the first statement that fails. A failed filesystem step names its cause (a missing file, a directory the tool cannot write) without a PHP warning printed above it. Full usage is documented in the repository README.
wp-content/plugins/ and activate it. On multisite, network activate it so the command is available for every site.wp mu-migration info to confirm the command is registered.Requires PHP 8.1 or newer with the zip extension, WordPress 6.1 or newer, and WP-CLI with a mysql or mariadb client that can log in to the database server: the import, the backup and the export run WP-CLI's wp db commands. The MariaDB 11.8 client in the official WP-CLI Docker image cannot load caching_sha2_password, MySQL 8's default; against such a server, use a mysql_native_password database user or a MySQL client. There are no runtime Composer dependencies.
Updates are delivered through the Update URI header and the Manifest Updater plugin.
0.5.1
\nexport all needs its <zip>, export users its <file> and import users its --map-file; none has a default in the working directory any more, and an empty path is refused.--new-url and --old-url must start with http:// or https:// and a valid host, and may not hold %. A URL change whose new address is the old one plus a path is refused unless you pass --dangerously-allow-nested-url.--role-definitions=destination keeps the site's definitions, as before. The plan, the closing lines and the JSON run record (role_definitions) list, per role, the capabilities added and removed.import all refuses a package upload already on the site with other content, naming it, unless you pass --upload-collisions=keep or --upload-collisions=replace. One with the same content is skipped. replace moves the site's file into --backup-dir first, which it needs; the undo lines put it back. The plan and the JSON run record (upload_collisions) count them.import all with --plugins or --themes refuses a plugin or theme installed at another version than the package's copy, older or newer, naming both versions, unless you pass --installed-versions=keep or --installed-versions=replace. replace moves the installed copy into --backup-dir first, before anything else runs; the undo lines put it back and say to reset PHP's opcode cache. Replacing code another site of the network runs needs --dangerously-allow-shared-code-replace, and the refusal names those sites. The plan and the JSON run record (installed_versions) list each difference. After a replace, a live run says to reset PHP's opcode cache, in its closing lines or, under --format=json, as the run record's reset_opcode_cache./proc/self/mountinfo, a mount point inside the uploads, plugin or theme tree a move places files in, or in installed code --installed-versions=replace would move away (a single-file plugin mounted on its own included), refuses the run while the plan is built, naming the mount point, and again just before the move. A destination that is itself a mount point is fine. Where the mount table cannot be read, the plan and the run's closing lines say nested mounts were not checked, and the run goes on.FS_CHMOD_FILE and FS_CHMOD_DIR.run record carries them as undo.localhost is left alone. The uploads path moves in every form, and only in the site's own references.run record (url_leftovers).--uid-columns remaps plugin table columns of user ids. Comment authors are remapped by default, _customer_user wherever the key exists, and a user id of 0 means no user. Each remap is one statement per target, compares values exactly and refuses a column too narrow for the new ids; a bad id map is refused before anything runs.0.5.0
\nusers.json (format 2) instead of users.csv. A users.csv, or a package from before 0.5.0, is refused: re-export it with this version.mu_migration/export/user/headers filter is removed; what the mu_migration/export/user/data filter returns travels without it.--blog-id, --new-url, --old-url …); the underscore forms 0.4.0 took are refused, naming the new one. Flags take no value and cannot be negated.import tables and import users require --blog-id; import all requires --new-url or --same-url; import tables requires --old-url with --new-url, or --same-url. Without --blog-id, the exports read the site WP-CLI runs against, not blog 1.--yes skips it) and is refused when nobody could answer, and each dangerous effect needs its own acknowledgement flag (--allow-main-site, --dangerously-allow-drop-tables and the others listed above).--dry-run stops there. --format=json prints the plan and outcome as JSON Lines.--dangerously-allow-role-overwrite.--plugins and --themes, never over an installed copy; uploads are merged without replacing files.0.4.0
\n