I have created several custom image blocks inside gutenberg, but sometimes it happens that I got meesage “This block contains unexpected or invalid content”. When I try to click on resolve I can see editor is wrapping image with <figure> tag.
Has anyone seen the same thing? Or found a reason why this is happening and how to fix it?
Sometimes it happens to my blocks, and sometimes my blocks work fine and I can’t figure out a reason. Tnx
My starting point would be comparing your markup to the markup in the image examples from the course. It may be that something extra is added or missing. If you would like to share the plugin code would be happy to take a look 🙂
I had this same exact problem. I had a custom plugin that was used for creating custom pagination on posts using a regex pattern and returning the markup through wpautop function in wordpress core formatting.php. Wrapping the plugin to only filter content on the client side, not editors side, fixed it.
If you can’t figure out your issue I would resort to turning your plugins off one by one and see if that fixes it.