Last updated: December 01, 2026

Quick answer: use 3 checks—gallery block, attachment editor, and published post—to move WordPress galleries, captions, and alt text in an auto blog migration without losing metadata. If the images move without the media library records, captions and alt text often disappear from the front end even though the post content still looks intact.

Key takeaways

  • Gallery blocks depend on media IDs and attachment records, not just image files.
  • Captions usually live with the attachment or the block markup, so they can vanish in a partial import.
  • Alt text belongs in the media library metadata and may need a second pass after import.
  • The safest check is usually the imported post, the gallery block, and the attachment editor.
  • If the migration only copies URLs or HTML, expect more cleanup in WordPress after import.

What has to move with the images?

WordPress needs more than the image file to preserve a gallery. The visible image, the attachment post, the caption field, and the alt text field are separate pieces of WordPress media metadata.

That matters because an auto blog migration often copies post content in one pass and media in another. If the post keeps pointing to the old attachment ID, a gallery block may still render, but the captions can break, the alt text can stay blank, or the image can fall back to a plain <img> tag with no useful metadata.

The core pieces to watch are:

  • the media file itself in the uploads folder
  • the attachment record in the WordPress media library
  • the caption stored on the attachment or in the block
  • the alt text stored in the attachment metadata
  • the gallery block’s internal references to image IDs

WordPress documents these pieces in its export and import tools and importing content guidance, and the media library behavior is tied to those records rather than to the image file alone. The practical rule is simple: if the migration only moves content text, it is not enough for galleries. If it moves the post plus the attachment data, the odds are much better.

A generic migration guide often skips this and tells readers to “import the media.” That is too vague. In this case, the question is not whether the image exists after import. The real question is whether the imported post still knows which attachment owns the caption and alt text.

How do WordPress galleries store captions and alt text?

WordPress stores gallery captions and alt text in different places, and that is why one may survive while the other disappears. Captions are usually tied to the attachment or embedded in the gallery markup, while alt text lives in the attachment’s alt text field in the media library.

That split is why a gallery can look fine in the editor but still fail on the site after migration. A gallery block can hold image IDs, and each ID points to an attachment record. If the new site does not recreate those attachment records in the same way, the block loses the link that connects image, caption, and alt text.

Here is the part many beginners miss: gallery blocks are not just a pile of image URLs. They are structured content. The block often depends on the relationship between the post content and the media library, so a migration that strips out attachment IDs can leave only the image source, not the metadata you expected to travel with it.

WordPress and the W3C both treat alt text as meaningful image metadata, not decoration. WordPress keeps it in the media editor, and W3C’s alt text guidance is a useful standard to keep in mind when you review imported media. If you are unsure how your theme or importer handles that field, consult a WordPress migration professional before relying on a blank alt field.

When the migration is clean, captions stay with their images and alt text remains editable in the media library. When it is not, you often get one of these outcomes:

Migration result What you see What is missing
Full attachment import Gallery shows images, captions, and editable alt text Usually nothing
Content-only import Post content appears, but media links are weak Captions and alt text may need repair
File-only copy Images exist in uploads, but not as attachments Attachment metadata is missing
HTML rewrite only Image tags display, but IDs are gone Gallery structure is often lost
Comparison table of How do WordPress galleries store captions and alt text?
Comparison table: How do WordPress galleries store captions and alt text?

That table is the core trade-off. The more the migration reduces images to files or HTML, the more cleanup you inherit in WordPress afterward.

How do you move them in an auto blog migration?

You move them by importing the post content and the attachment data together, then checking each gallery block and each media item in the media library. The goal is to preserve the relationship between the post, the image, and the attachment metadata.

A workable migration flow looks like this:

  1. Export the WordPress content that includes attachments, not just posts.
    Use the WordPress export tool that carries media attachment references when possible. The result you want is a file that can recreate posts plus the attachment records, not just the written text.

  2. Import into the new WordPress site with media handling turned on.
    Use the importer that can fetch or recreate the media attachment entries. The result should be images appearing in the media library, not only in the post body.

  3. Open a migrated gallery block and check the image IDs.
    A gallery that still points to valid IDs is more likely to keep its structure. If the block has broken references, expect missing captions or images that no longer belong to the gallery.

  4. Open each image in the media library and check the caption and alt text fields.
    The caption should appear in the attachment editor, and the alt text should still be editable there. If both fields are blank, the import likely lost metadata rather than just display markup.

  5. Review the published post, not only the editor view.
    The front end is the final check. A gallery can look normal in the block editor and still fail in the theme if the theme handles captions or gallery markup in a custom way.

  6. Fix the few images that need manual repair.
    If only some images lost captions or alt text, edit those attachments one by one in the media library. This is slower than a bulk import, but it is the cleanest fix when the migration left the files intact.

So, in practice, do not stop at the uploads folder. A migration for WordPress media metadata is really a 3-part check: file, attachment record, and block reference.

What breaks captions after import?

Captions usually break when the import loses the attachment record, strips the gallery block structure, or rewrites image markup too aggressively. A plain image file does not preserve the WordPress relationship that made the caption visible in the first place.

The most common failure is a content-only migration. The text imports, the image tags appear, but the original attachment IDs are gone. That can happen when an auto blog tool pulls HTML from the old post and recreates it on the new site without also recreating the media library entries. The result is a page that looks incomplete and behaves like it was assembled from scraps.

Another problem is theme output. Some themes show captions only through a specific gallery or image template. If the new site uses a different theme, the caption may still exist in the media library but not show where you expect it. That is why the published page matters more than the admin screen.

There is also a block-editor issue. Gallery blocks can preserve structure better than raw HTML, but only when the import keeps the block data intact. If the migration turns a block into plain content, the caption can fall out even though the image remains.

Here is a practical comparison of the main paths:

Method Caption outcome Alt text outcome Best use
Full WordPress export/import Often preserved Often preserved Best first choice
HTML scraping Often fragile Often lost or detached Only when nothing else is available
File copy without attachment import Usually broken Usually broken Not enough for metadata
Manual rebuild in media library Preserved after cleanup Preserved after cleanup Best for a small number of images

The honest answer is that captions are easier to lose than most people expect. If the migration tool does not understand attachment metadata, it is not a full migration for galleries.

How do you keep alt text after migration?

You keep alt text after migration by importing the attachment records and then checking the media library field for each image. Alt text is not stored as a visible part of the post body in a way that survives every migration tool.

That makes alt text the first thing to disappear in weaker auto blog setups. Some tools move the image URL and skip the attachment post. Others recreate the image but leave the alt text field blank because the importer only handles file transfer, not metadata. When that happens, the front end still shows the picture, but the accessibility value drops to near zero.

However, two safe habits help here. Check the media library after import, not before. Then compare the imported image count with the number of alt fields that actually contain text. A site can have dozens of images and still be missing useful alt text on many of them.

This is also where a lot of people make a bad assumption: if the caption survived, the alt text must have survived too. That is not true. They live in different fields, and WordPress treats them differently in the editor.

For a small migration, the repair path is straightforward:

  • open Media Library
  • choose the imported image
  • fill in the alt text field
  • save
  • revisit the post or gallery block where the image appears

If you have many images, the work grows fast. That is the main drawback of partial imports: you may save time during the migration and spend it later fixing metadata one file at a time.

WordPress’ own media editor is the right place to confirm the change. If the alt field is empty there, the migration did not preserve it. If it is filled there but not visible on the page, the theme or block output is the thing to inspect.

What should you check before you publish?

You should check the gallery block, the attachment editor, and the live post before you publish. Those three views catch most migration failures in under 10 minutes.

Start with the gallery block in the editor. Make sure the images are still in the right order and that the block did not collapse into plain image tags. Then open a few images in the media library and confirm that captions and alt text are still present. Finally, load the page on the front end and check whether the theme displays captions the same way the editor did.

If something is off, do not guess. Use a simple checklist:

  • image displays on the page
  • caption appears under the image
  • alt text is stored in the media library
  • gallery order matches the source
  • no image points back to the old site’s attachment link

That last point matters in auto blog migrations. A leftover old link can make the page look functional while still sending users or crawlers to the wrong place. It is a subtle error, and it can hide in plain sight.

This is also the point where the WordPress export/import tools and the media library should agree. If the post shows one thing and the attachment editor shows another, the migration is incomplete. Fix the attachment first, then recheck the post.

For a broader migration plan, this page sits inside the WordPress auto blog migration content transfer hub, which covers the rest of the content-moving pieces without mixing them up with media metadata.

When is this the wrong fix?

This is the wrong fix when the migration only needs image files moved, not captions or alt text, or when the source and destination sites intentionally use different media structures. In those cases, trying to preserve every attachment detail can slow down the move without improving the result.

It is also the wrong approach if the migration tool cannot recreate attachment records at all. Then the time spent forcing the issue may be better spent on a manual rebuild of the few images that matter most. A small site with 12 important galleries may justify that work; a large auto blog with hundreds of images may not.

The trade-off is simple: full metadata preservation takes more care, but it usually means fewer repairs later. File-only migration is faster, but it pushes the cleanup into the media library and the gallery blocks. If captions and alt text matter for presentation or accessibility, the faster route usually costs more in the end.

For readers trying to preserve the visible structure of posts, this method is the right fit. For readers who only care that the photos exist somewhere on the new site, it may be more work than needed.

Does WordPress export alt text with images?

WordPress export can carry attachment data, but alt text is only useful if the import recreates the media attachment records on the new site. If the migration strips images down to files or HTML, the alt text field may not come across in a usable way. The media library is the place to confirm it after import.

How do I keep gallery captions after importing content?

Keep gallery captions by importing the gallery block and attachment data together, then checking the imported images in the media library. If the gallery turns into plain HTML or the attachment IDs change, captions can drop out even when the image still appears. A published page check is usually the fastest way to catch that.

Drafted with AI; not yet reviewed by a person.