Although nothing is visibly affected on your live website, when editing a page or a post, you might see an error over some of the blocks: “This block contains unexpected or invalid content.” This error usually shows up after updating your WordPress theme, plugins, or the WordPress version installed on your website.
This can happen for two main reasons:
- You edited the HMTL of the block using the Code Editor, which generates a syntax error.
- An update to the WordPress theme, plugins, or WordPress core came with a few changes in the block’s markup. Most likely, the block benefited from a change (for the better), and you need to take some action to apply the changes.
How to fix the unexpected or invalid content block error
In both of the cases above, there is a simple solution that should work in most cases: click the Attempt Block Recovery button.
Once you click it, the block should refresh and show up correctly in the WordPress editor.
If that doesn’t fix the problem, I recommend contacting the customer support team for further investigation.
Can I fix all blocks on the website?
Usually, if you are using the same block that received an update in multiple places on your website (which you probably do), you will see the same error repeatedly. Unfortunately, there isn’t a way to apply the fix across the website or page—the only way is by manually fixing each block using the methods previously described.
The good thing is that you most likely won’t have any visible errors on the live website, which means that, even if you don’t fix every block, your website will still work and look the same. You can leave the fixing for when you make changes to a particular page.