Last updated: November 28, 2026

Quick answer: in a WordPress migration for how to migrate featured images and image metadata without breaking posts, move 3 things together: the attachment record, the image file, and the metadata. The posts keep their thumbnail references through attachment IDs, and those IDs only stay useful if the attachment post type, image metadata, and image sizes come across together.

Key takeaways

  • Featured images in WordPress are usually stored as attachment IDs, not file names.
  • Copying image files alone leaves posts pointing at missing attachments.
  • Alt text, captions, descriptions, and intermediate image sizes are separate pieces of data.
  • A clean migration keeps the database reference and the media file in sync.
  • If thumbnails vanish after migration, the file may exist while the attachment record does not.

What has to move with the images?

The featured image must move as a WordPress media attachment, not as a loose file in the uploads folder. That means the file, the attachment post type row in the database, and the image metadata all need to stay linked so the post can still point to the right media item.

A lot of migrations break here because the image file is present on disk, but WordPress no longer has the attachment record that gave it an ID. When that happens, a post can still show a broken featured image even though the same picture seems to exist in the Media Library.

The main pieces are simple:

  • the file itself in the uploads path
  • the attachment post type entry in the database
  • the featured image reference in the post
  • alt text, caption, and description
  • intermediate image sizes such as thumbnails and medium sizes

WordPress uses the attachment ID as the bridge. The post does not usually store “this is image.jpg”; it stores “this is attachment 123.” That is why a file copy by itself is not enough.

For a plain source of truth on how WordPress treats media and images, the WordPress documentation on the Media Library and image handling is the right place to check, and if the migration is important or complex, it is sensible to consult a WordPress professional as well: https://wordpress.org/documentation/article/media-library-screen/ and https://wordpress.org/documentation/article/working-with-images/. Those pages are basic, but the model matters here.

If the destination site already has media with the same file names, the problem gets worse. WordPress can hold two different files with similar names, but the post still needs the correct attachment ID, not just a matching name on disk.

Featured images break when the post reference survives but the attachment record does not. That usually happens in one of three ways: the database export skips attachment rows, the media folder is copied without metadata, or the import creates new attachment IDs that do not match the old post references.

The most common symptom is a blank thumbnail box in the post editor or on the front end. The file may still exist in /wp-content/uploads/, but the post meta key that stores the featured image points to an ID that no longer resolves in the new site.

Here is the core problem in plain terms:

What moved What breaks What the reader sees
Files only Attachment ID link Empty featured image
Database only Missing image file Broken image placeholder
Files and database, but IDs changed Post reference mismatch Wrong image or no image
Files, database, and metadata together Nothing should break Featured image still matches the post
Comparison table of How do featured images break during migration?
Comparison table: How do featured images break during migration?

This is why “copy the uploads folder” is not a full migration plan. It moves the image bits, but it may not preserve the WordPress record that makes the image usable as a featured image.

The attachment post type matters here because WordPress treats media as posts of its own, and if you want a precise plan for a live site, it is wise to check the WordPress documentation or ask a WordPress professional before changing the database structure. That means the image has its own record, its own ID, and its own metadata. If any one of those pieces is rebuilt in a new way, the original post may lose the link.

A beginner often assumes the file name is enough. It is not. WordPress cares about IDs and metadata first, file names second.

A safer way is to move posts and attachments together, keep the original attachment IDs where possible, and then regenerate image sizes after the import if the theme or server needs it. That keeps the post references intact and reduces the “file exists, thumbnail missing” problem.

Use this workflow:

  1. Export posts with their attached media references intact.
    In WordPress, the post content and the featured image reference should travel together. The result you want is a post record that still knows which attachment was its thumbnail.

  2. Move the media attachments as attachment post type records, not just files.
    This keeps the WordPress media library entries alive. The result should be a visible media item with an ID, not a folder full of orphaned images.

  3. Copy the uploads folder alongside the database data.
    This gives WordPress the actual image files that the attachment records point to. The result is that the Media Library can resolve the file path instead of showing a dead link.

  4. Bring over image metadata fields.
    That includes alt text, captions, and descriptions. The result is that the media item still carries the text that editors added before the migration.

  5. Check that intermediate image sizes still exist or can be rebuilt.
    WordPress creates several image sizes from one file, so the thumbnail version may not be the original upload. The result should be a working featured image in the exact size the theme expects.

  6. Regenerate image sizes if the new site uses different dimensions.
    This is often needed after a theme change or a server change. The result is that the Media Library can recreate the missing thumbnail, medium, and other intermediate sizes.

That last step matters because the featured image on a post may point to a size variant rather than the original file. If the old site had one set of dimensions and the new site has another, the post can look fine in the editor but wrong on the front end.

If the migration tool you use can preserve attachment IDs, that is the cleaner path. If it cannot, the migration still can work, but the post-reference problem becomes much more likely.

What needs to transfer in image metadata?

Image metadata needs to transfer because the visible picture is only half the record. The other half is the text and sizing data WordPress stores with the attachment, and that data affects both editing and display.

The main metadata pieces are:

  • alt text
  • caption
  • description
  • file path data
  • intermediate image sizes

Alt text is especially easy to lose because it is not part of the image file itself. It lives in the WordPress record around the file. If the file is copied but the attachment row is recreated from scratch, the alt text may disappear unless it is mapped back in.

Captions and descriptions can vanish for the same reason. They are stored as attachment fields, not embedded inside the PNG or JPG. That is why a media migration that “works” visually can still strip useful editor text.

As a result, intermediate image sizes are the quiet problem most people miss. WordPress often generates more than one version of the same image, and themes may use a particular size for featured images. If those sizes are missing, the site may pull the wrong version or show a stretched crop.

WordPress core documents the image size system in its image handling docs, and that system is the reason regeneration matters. One original upload can create several derivatives, so a migration has to preserve more than the source file.

This is also where a clean import is better than a manual file copy. A manual copy can get the picture onto the server in minutes, but it can leave out the text and size records that make the image usable in the editor.

How do I keep attachment IDs from changing?

Keep attachment IDs from changing by importing the original attachment records instead of rebuilding them from scratch. That is generally the best way to keep the post meta link stable when a post already points to a specific featured image ID.

If the IDs change, the post’s featured image reference no longer matches the media item in the new site. The post may still load, but the thumbnail box may point nowhere or at the wrong attachment.

This is the trade-off:

Approach ID preservation Risk
Rebuild media from files Low Posts lose thumbnail links
Import attachment records Higher Depends on correct mapping
Copy database and uploads together Highest Needs careful handling of duplicates

A lot depends on the migration path. If the move is a full WordPress-to-WordPress transfer, the database tables that contain attachment posts and post meta need to stay consistent. If the media is imported separately later, WordPress may create fresh IDs for the same files, and that breaks the old references.

This is also why attachment IDs are more important than file names. A file named image-1.jpg can be copied to three sites and still point to three different attachment IDs. The post only cares about the ID it was assigned when the image became its featured image.

The rule is simple: do not rely on the file name to reconnect the post to its thumbnail. Use the attachment record, or expect to repair the references afterward.

What should I check after the import?

Check the Media Library, the post editor, and a few front-end posts after the import, because that is where attachment problems show up first. A migrated image can exist in the library and still fail as a featured image if the link from the post was lost.

Start with three checks:

  1. Open a post that had a featured image before the move.
  2. Confirm the thumbnail appears in the editor and on the published page.
  3. Open the Media Library item and check that alt text, caption, and description still exist.

If the image shows in the library but not in the post, the attachment exists but the post reference is broken. If the post shows a blank placeholder but the media item exists, the file path or size variant is probably missing.

Image regeneration is the last repair step when the files and records are present but the theme needs new dimensions. That step does not fix broken IDs, but it can fix missing thumbnails and stale image sizes after a move.

If the site has a lot of posts, sample a few from different dates rather than checking only the latest ones. Older uploads are the most likely to reveal missing intermediate image sizes because they may rely on an earlier theme or image configuration.

The WordPress codex and documentation around media handling are the right reference points here, not generic file-copy advice. This is a WordPress record problem first and a file problem second.

When should I avoid a simple file copy?

Avoid a simple file copy when the posts already depend on featured images, captions, or alt text, because file copy alone does not preserve the attachment relationship. It also fails when the destination site needs the original attachment IDs to stay valid.

A file-only move is not enough for a site that uses the Media Library as part of its content structure. That is especially true when posts were written around image placements, not just around body text.

Simple file copy is the wrong choice if:

  • the site uses featured images on many posts
  • the editor depends on alt text and captions
  • the theme uses specific intermediate image sizes
  • the import must keep old attachment IDs tied to old posts

If none of that matters, file copy may be acceptable for raw storage. But that is a different job from preserving a WordPress post history.

For the larger move across sites, this image work belongs inside the broader migration plan covered by the main guide to moving an auto blog from one WordPress site to another. This page stays focused on the media layer so the post-body migration and the image migration do not get mixed together.

Why do featured images disappear after a WordPress migration?

Featured images disappear after a WordPress migration when the post still points to an attachment ID that no longer exists on the new site. The file may still be on the server, but WordPress cannot match it to the post.

That usually means the database reference, not the image itself, is missing or changed. A media library rebuild, a partial import, or a file-only copy can all cause that problem.

Can I preserve alt text when moving images?

Yes, but only if the migration carries the attachment metadata, not just the file. Alt text is stored with the WordPress media attachment, so a plain upload copy will not keep it by itself.

If the attachment post type record is imported correctly, the alt text can move with it. If the record is rebuilt, the alt text often has to be re-entered.

Drafted with AI; not yet reviewed by a person.