Free tool · WordPress · Step 4 of 4: Install

WordPress export ID and link fixer

Moving content into a WordPress site that already has posts? Fix the export first. Items whose IDs are taken on the new site get free IDs, and the featured images, parents, menu items, wp-image-N classes, galleries, core media blocks and ?p= links that point at them change with them.

For people who move WordPress content between sites with the WordPress importer. Runs in your browser: nothing is uploaded or stored, and nothing is imported. The fixed file is a draft to review.

A made-up bakery site with eight items, first free ID 120, and a two-row redirect list. Then press "Fix the IDs".

2. Which IDs are taken on the new site

Everything is read in this browser tab. Nothing is uploaded, stored or imported. Free for one file of up to 50 MB per run. Larger runs: request access.

I have a tools pass code

With a tools pass this tool runs one export file of up to 200 MB. See the self-serve prices.

What it does and does not do

It fixes the file before import, and only the file

What it reads

One WordPress export (the .xml from Tools, then Export), up to 50 MB, and the first free ID on the new site. Or, as a hint, the new site's own export. Optionally a redirect list of old and new URLs. All of it is read in your browser.

What you get

A draft copy of your export where colliding items have new, free IDs and these references to them are changed: wp:post_id, wp:post_parent, the featured image, menu items, wp-image-N classes, [gallery ids], the id, ids and mediaId block attributes, and ?p=, ?page_id= and ?attachment_id= links. Plus changes.csv (every change) and unmatched.csv (references with no match).

What it does not do

Nothing is imported or uploaded, and the tool does not touch your live site. It does not change ACF or other plugin fields, serialised data, shortcodes other than [gallery], or blocks other than the core media blocks listed below. It does not fix a site you have already imported.

What the importer does with it.

  • The WordPress importer keeps an item's ID (import_id) only when that ID is free on the new site. Otherwise the post gets a new number, and the importer puts that number into _thumbnail_id, post_parent and menu items only. References in content keep the old number.
  • The importer skips an item when the new site already has a post with the same title, date and post type.
  • The new IDs are free only at the moment you read them. A post, revision or auto-draft created on the new site after you read the first free ID (or exported the new site) can still take one of them. Read the number again just before you import, and import soon after.

Free within a limit. One export file of up to 50 MB per run, as many runs as you like, no account. With a tools pass this tool runs one export file of up to 200 MB: see the self-serve prices. Larger runs: request access.

Not tested on an import. We tested the tool on files we wrote in the format of WordPress's own exporter. We have not imported a fixed file into WordPress ourselves. Try it on a test site first and keep your original export.

Other free tools

What else exists, and how this differs

This tool works on the export file before import, with a list of old and new IDs, and changes the references inside content with them. The tools below work on a live site after import, or keep the old IDs instead. Each is a good tool for its own job.

  • WP-CLI wp search-replace searches and replaces strings in the database of a live site, after import. It needs shell access. It has no list of old and new IDs. WP-CLI: wp search-replace, checked 16 Nov 2026.
  • The Better Search Replace plugin runs a search and replace on the database of a live site, with serialised data and a dry run. It has no list of old and new IDs. Better Search Replace on wordpress.org, checked 16 Nov 2026.
  • Migravo WXR Media Migration (version 1.2.2, fewer than 10 active installs) remaps ACF Relationship, Post Object and Gallery field IDs by slug after import, and rewrites image addresses to local copies. Its page does not mention gallery shortcodes, wp-image-N classes or block attributes. Migravo WXR Media Migration on wordpress.org, checked 16 Nov 2026.
  • Weston Ruter's gist is a plugin for the importer that keeps the original IDs. When a post already has that ID, it overwrites it; the gist says to use it only on a new or non-canonical site. Weston Ruter, wordpress-importer-post-id-preservation.php (GitHub gist), checked 16 Nov 2026.
  • aucor-repair-content-image-sizes is a WP-CLI command that fixes image sizes in content on a live site, reading the wp-image-N class. It does not renumber IDs. aucor/aucor-repair-content-image-sizes (GitHub), checked 16 Nov 2026.
  • wp-reset-post-ids renumbers posts in a live database by publish date. Its readme says to use it only on new installs and that attachments are not updated. arminrosu/wp-reset-post-ids (GitHub), checked 16 Nov 2026.
  • wordpress-export-to-markdown has an open request to rewrite links between exported posts (issue #98). wordpress-export-to-markdown issue #98, Rewrite Links, checked 16 Nov 2026.

Sources

Where the rules come from

Each statement was read on the page linked beside it, checked 16 Nov 2026.

Questions

Common questions

Why would IDs in my export collide?

The WordPress importer asks for each item's old ID. WordPress uses it only when no post on the new site has that ID. When it is taken, the post gets a new number, and the importer changes the featured image, the parent and menu items to match. Content keeps the old number: an image block or a wp-image-N class then points at the wrong attachment, or at nothing.

Where do I find the first free ID?

On the new site, just before you import. The posts table's AUTO_INCREMENT value is the next ID WordPress will give (phpMyAdmin shows it on the table's Operations tab). Or run wp db query "SELECT MAX(ID) FROM wp_posts" and add 1 (use your own table prefix if it is not wp_). Posts, pages, media, menu items, revisions and auto-drafts all share that table.

Why is the new site's export only a hint?

An export leaves out revisions, auto-drafts and items in the bin, and they take IDs too. So an ID that is not in the export can still be taken. Typing the first free ID read from the database is the safe choice.

Can posts still collide after I fix the file?

Yes, if someone or something creates a post, revision or auto-draft on the new site between reading the first free ID and running the import. Read the number again just before you import, and import soon after. The importer also skips an item when the new site already has a post with the same title, date and post type.

Doesn't the importer change links to the old site?

Since version 0.9.1 the WordPress importer can change links to the old site's address into the new site's address. That changes the host, not the path. If pages also get new addresses, the redirect list here swaps each exact old URL for its new one before import. The two work together.

Is my file uploaded?

No. The files are read by code running in your browser tab. No part of them is sent to our server or stored, and the downloads are built in the same tab.

Surge Migrate is not affiliated with WordPress, the WordPress Foundation, WP-CLI or the makers of the plugins named on this page.

Step 4 of 4: Install

Free tools that go with this one

This tool does one job in the Install step. Files made ready for the import or the host. You load them yourself.

All free tools, by step and by who they are for →

Moving the whole site? Converted automatically. Checked before you install.

Enter your page addresses. Surge Migrate reads the public pages, converts them into the import format of the system you are moving to, and reports what it could not place. You check the result first, then run the import yourself.