The core risk in this kind of migration isn’t losing text, it’s silently losing gallery images or captions because a shortcode didn’t match the expected pattern exactly. Always re-open the converted post in the visual editor afterward and check that every image and gallery still renders, WordPress won’t error on a malformed shortcode, it’ll just print it as literal text on the live page.
Gutenberg
Convert a Classic Editor post to blocks without losing formatting
A scenario prompt that migrates a 2019 post full of shortcodes and inline alignment styles into clean block markup, preserving every image caption and gallery instead of letting them collapse into a Classic block.
Works with Claude / GPT540 uses★ 4.1
The prompt
gutenberg-classic-editor-to-blocks-conversion
I'm cleaning up an old post that was written in the Classic Editor back in 2019. Its raw content (from the database, `wp_posts.post_content`) looks like this: [paste the raw post_content here, including any [gallery ids="12,14,19"] or [caption id="attachment_45" align="alignleft" width="300"]<img ...>Caption text[/caption] shortcodes, and any <img style="float:left; margin:10px"> tags] Convert this into native block markup, not a single Classic block wrapping the whole thing (that "works" but defeats the point of migrating). Work through it carefully: 1. Find every `[caption]` shortcode and convert it to a `wp:image` block with the caption text moved into the block's built-in caption field, keeping the align attribute (alignleft/alignright/aligncenter) as the block's align setting rather than leaving it as inline CSS. 2. Find every `[gallery ids="..."]` shortcode and convert it to a `wp:gallery` block referencing those same attachment IDs, preserving the original order. If an ID in the list no longer resolves to a real attachment, don't silently drop it, flag it instead since the image may just need re-uploading. 3. Convert `<img style="float:left">`-style inline alignment into block align settings, and strip the inline style attribute entirely once converted, leftover inline styles are the most common reason a "converted" post still looks broken. 4. Turn plain paragraphs, headings (even ones that were just `<strong>` wrapped in a paragraph in the old editor), and blockquotes into their matching blocks. 5. Any shortcode you don't recognize (a custom one from a retired plugin, for example), leave it untouched and flag it rather than guessing at a block equivalent, since guessing wrong can silently drop functionality. 6. Output full block comment markup ready for the code editor view, and list out anything you flagged in step 2 or step 5 separately below the markup.