• We imported blog posts into a new site using the Tools > Export WordPress option, and when we imported it to the new site the posts were blank on the Categories pages – no excerpts at all.

    Checked the posts, and it shows all these weird div tags and comments that shouldn’t be there – so we then realized the old site must have been using Gutenberg editor. So we don’t like Gutenberg, we only use Classic.

    How do we get all this code out of the database easily?

    <!– wp:paragraph –>
    <!– wp:image {“id”:5439,”align”:”center”,”width”:594,”height”:297,”linkDestination”:”media”} –>
    <div class=”wp-block-image”>

    etc. etc. etc.

    Want it all GONE.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Treebeard

    (@malawimama)

    Update – I think the import broke all the posts somehow because I tried deactivating Classic editor, and testing using Twenty Nineteen theme, and they’re still blank. Titles are there, but no excerpts. And the full articles are there too, so it’s just the blog categories that have this issue.

    Thread Starter Treebeard

    (@malawimama)

    Solved: replaced my old get_the_excerpt code with wp_trim_words but it was very strange since the Twenty Nineteen theme should have loaded all those excerpts. Anyway, if anyone does know of a way to delete those weird comments and divs from the database, that would be cool.

    Hi there,

    Glad to see that you were able to solve some of the issues you were dealing with.

    Unfortunately, there isn’t really a quick way to remove the Gutenberg comment tags. You’d have to remove them post by post. They’re simply present to let the software know that those posts were created with Gutenberg blocks. Therefore, they are going to continue to be a part of the code even if you switch to the Classic Editor. Because of this, they would have to be manually removed one by one in the HTML tab of each post.

    Additionally, if any of this is showing on the front-end, that means those particular Gutenberg blocks aren’t compatible with the Classic Editor. You would need to re-add the content and remove the broken code.

    Sorry that was probably not the solution you were hoping for, but I hope it helps answer your question!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove broken gutenberg code from posts?’ is closed to new replies.