Linux 软件免费装
Banner图

Migravo WXR Media Migration

开发者 dinhqui
更新时间 2026年8月12日 11:57
PHP版本: 7.4 及以上
WordPress版本: 7.0
版权: GPLv2 or later
版权网址: 版权信息

标签

migration media import acf wxr

下载

1.1.3 1.2.0

详情介绍:

Import an export into a new WordPress site and two things break that nothing in the box will fix for you. ACF Relationship, Post Object and Gallery fields stop working. They store post IDs, and the new site assigns different IDs, so every one of those fields now points at the wrong post or at nothing at all. Nothing reports it. The fields simply look empty, or worse, quietly reference unrelated content — and on a site built around related posts, professionals, case studies or products, that is most of the site. Every image still lives on the old server. The core importer copies the references, not the files. The content looks fine right up to the day the source site is switched off. Migravo fixes both, on a site that has already been imported or as part of importing it. Repairing relationships Upload the export from the source site on the ID Map tab. Migravo matches each old post to its new one by slug, builds a map of old ID to new ID, then rewrites every relationship, post-object and gallery field on the site in one pass. It sweeps the whole database rather than one post type, so both sides of a two-way relationship are repaired as long as both are present — the field on the Artist and the field on the Song are just two more fields to fix, and it does not matter which order you imported them in. Import one post type now and the other later, then run the repair again: the map keeps what it already knows and grows as you import. It only rewrites values it can account for. A flat list of numeric IDs is remapped; an ACF Link field, a repeater row, a phone number that merely starts with digits, and any ID with no entry in the map are all left exactly as they were. An ID whose target has since been deleted is reported rather than written as a dead reference. And it tells you what it could not fix, as a verdict rather than a guess. An ID it has no mapping for is left alone — correct in itself, but the field still points somewhere wrong and the number still looks like a valid ID, so nothing errors. Migravo checks each one against the field's own definition: ACF records which post types a Relationship or Post Object field may reference, so a practice_areas field declared as accepting service while holding an ID that is a trade_report here is broken as a matter of fact. Those are reported as broken and listed first, with how many fields hold each ID and what it actually is. Values that match the type the field accepts are marked as almost certainly already repaired, so re-running the tool does not raise false alarms. Import the missing post type and run it again; the map grows as you import, so order does not matter. Re-hosting media During import, Migravo finds every media URL in the post content and the featured image, downloads each file from the source site into the Media Library, and rewrites the content to point at the local copy. Files are deduplicated by source URL and filename, so importing the same export twice does not produce a second copy of every image. What else the export carries, and what arrives with it A WXR file says more about each post than its title and content, and a field that is read by nothing is a field that goes missing without a word. These now come across: Each is applied only where the export actually states it. An empty tag is a statement — "no password", "not sticky" — and is honoured on a re-import; a tag that is not in the file at all says nothing, and nothing on this site is overwritten on the strength of it. One limitation worth knowing. Posts are tied back to the source by the ID the export gives them, and that ID is not qualified by which site it came from. Import two different sites into one destination and a post from each can claim the same source ID; the hierarchy lookup then has two candidates and takes the most recent. This is inherent in what a WXR file records, not something the plugin can detect, and it applies equally to the relationship repair. The rest of a real migration Security Why not just use the core WordPress Importer? Use it — and then use this. The core importer creates the posts, which is the part that already works. What it has no concept of is what became of everything that referenced those posts by ID, or of the files they pointed at: Is this a full-site migration tool? No, and deliberately not. If you can copy an entire site — database, uploads and all — a tool built for that is the right choice and this is not it. Migravo is for the cases where you cannot: you have a WXR export and a destination that already exists, you are pulling a few post types across rather than cloning a whole site, or you are on the other side of an import that already happened and left broken relationships behind. The ID Map tab works on a site that was imported months ago by something else entirely. Two things in a WXR file are deliberately not imported, and are not planned: Run the core importer for either of those, then use this for the parts it leaves behind.

安装:

  1. Upload the plugin folder to /wp-content/plugins/.
  2. Activate the plugin through the "Plugins" menu in WordPress.
  3. Go to Tools → Migravo Migration.

升级注意事项:

1.2.0 Imported page trees were arriving flat: wp:post_parent was read by nothing, so every child sat at the top level. Image alt text, comment and ping status, sticky, and post password now come across too — a password-protected post used to arrive public with nothing said. 1.1.3 Fixes an image being matched to the wrong local file. Identification was by filename alone, so a source image at 2025/06/logo.png could resolve to a local 2024/01/logo.png — the wrong picture, silently, and the right one never downloaded. Matching is now on the upload path. 1.1.2 Security fix: temporary import files sat at a predictable path protected only by an .htaccess, which nginx, LiteSpeed and IIS ignore — the export and every imported post were readable by anyone during an import. The directory name is now random. Upgrading removes the old one. 1.1.1 Security fix: on 1.1.0 a media URL that redirected could reach an internal address, including the cloud metadata endpoint. 1.0.0 refused redirects and is unaffected. Also fixes imports over an hour being deleted by the plugin's own cleanup. 1.1.0 Imported the same file twice with 1.0.0? Check for duplicates: slugs with characters WordPress strips (such as a leading dollar sign) were not recognised, so re-imports made extra copies ending in -2. Sort by slug to find them. 1.1.0 cannot remove them.

常见问题:

My ACF Relationship fields are empty after importing — can this fix it?

Yes, and that is the main reason the plugin exists. Those fields store post IDs, and the new site handed out different IDs, so the values that survived the import now point at nothing — or at whatever unrelated post happens to hold that ID. Open the ID Map tab and upload the export from the source site. Migravo matches every old post to its new one by slug, then rewrites every Relationship, Post Object and Gallery field on the site to the correct new IDs — every post type at once, so both directions of a two-way relationship are fixed provided both sides are on the site.

Can I use it on a site that was already imported by something else?

Yes. The ID Map tab needs only the original export file and the site as it stands now; it does not care what performed the import or how long ago. If a migration left broken relationships behind months ago, this repairs them without re-importing anything.

Which field types get remapped, and which are left alone?

Remapped: flat lists of post IDs, which is how ACF stores Relationship, Post Object, Gallery and similar fields. Left untouched: anything that is not a plain list of IDs. An ACF Link field (title/url/target), repeater rows, a value that merely starts with digits such as a phone number, and any ID with no entry in the map are all written back exactly as they were. An ID whose target has since been deleted or trashed is counted and reported rather than written as a dead reference.

What XML format does this accept?

Standard WordPress eXtended RSS (WXR) — the same file produced by any WordPress site's Tools → Export.

Does it download media from the old site automatically?

Yes, when "Download Media" is checked. It scans the post content and featured image for URLs on the source site's domain, downloads each into the Media Library, and — if "Update URLs in Content" is also checked — rewrites the content to point at the new local URLs.

What happens if a post already exists?

You choose per import: skip it, update its content and media in place, or replace it (delete the existing post and re-import fresh). Matching is by title + slug + post type.

No media was imported from my staging site — why?

Almost certainly because that site is on a private network. Staging and development sites usually resolve to a private address (10.x, 172.16–31.x, 192.168.x), and the plugin refuses to fetch from those by default: an import file comes from outside your site, and blindly following the URLs inside it is how a server ends up reading its own internal services. If you know the source site and want to allow it, name that one host: add_filter( 'wxmi_allow_private_media_host', function ( $allow, $host ) { return 'staging.example.com' === $host ? true : $allow; }, 10, 2 ); Only the host you name is allowed. Loopback, link-local and every other private host stay blocked, and there is no setting in the admin screen to switch this on — it takes deliberate code on your own site.

Does it work on Multisite?

Yes — a site selector appears wherever it's relevant (import, ID map, ACF field lookup) so you can target any site in the network without switching your admin session.

What if a scheduled cleanup is needed?

An hourly cron job (wxmi_cleanup_temp_files) removes temporary uploaded XML/cache files older than one hour, in case an import session is abandoned partway through.

更新日志:

1.2.0 Five fields the export carries were read by nothing, so an import produced a post that only partly resembled the source. Each was checked against WXR generated by WordPress itself rather than a file written by hand, and against real exports, on a first import and on a re-import. 1.1.3 1.1.2 Security: Housekeeping: 1.1.1 Every item below was reproduced before it was fixed, and the same test was run again afterwards. Two of them were found only because the plugin was pointed at real exports rather than a test site. Security: Reliability: Interface: 1.1.0 Tested against a real 52 MB / 5,179-post WXR export. Every item below is a problem that export exposed. Reliability: Data integrity: Interface: Media download: Housekeeping: 1.0.0