Broken images after importing posts and opening in Gutenberg


I imported posts from a site into my Woocommerce site, and some have broken images.

When I open the post to edit, the Gallery in the post is converted to Gutenberg blocks.

Not all the images are converted correctly. Some are okay, and have HTML code that looks like this:

<!-- wp:image {"id":1935,"linkDestination":"attachment"} -->
<figure class="wp-block-image"><a href=""><img src="" alt="" class="wp-image-1935"/></a></figure>
<!-- /wp:image -->

Some look like this, and are broken:

<!-- wp:image {"id":1936,"linkDestination":"attachment"} -->
<figure class="wp-block-image"><img alt="" class="wp-image-1936"/></figure>
<!-- /wp:image -->

Some look like this, and are broken:

<!-- wp:image {"id":1922,"linkDestination":"attachment"} -->
<figure class="wp-block-image"><a href=""><img alt="" class="wp-image-1922"/></a></figure>
<!-- /wp:image -->

So, it looks like the conversion process rewrites the code, and it must be getting some of the attributes from somewhere, maybe the server.

The good news is that these images are present in the Media Library, and are attached to the post.

I’m wondering if there’s a tool that will fix the HTML, creating the A tag and IMG tag correctly?

John Kawakami 1 year 2022-09-04T03:46:08-05:00 0 Answers 0 views 0

Leave an answer