Error: This block contains unexpected or invalid content
-
On any page I edit, I’m receiving the error: “This block contains unexpected or invalid content.”, when using the “edit as HTML” option. There is no error in the code.
For example, even with a simple change:
<p style="margin-top:50px">Text here</p> <p style="margin-top:51px">Text here</p>All I did was change the px from 50 to 51. Clearly…no error, and when I use the sidebar to change the top margin to 51 instead of editing the HTML, it uses the same code anyways. What’s happening that I’m getting the error when the code is correct?
The blog I need help with is: (visible only to logged in users)
-
You can check how to solve the issue, and more information on it here: https://wordpress.org/documentation/article/block-error-unexpected-or-invalid-content/#ways-to-solve-the-error.
The message that you see shows up when the block is seeing any unexpected changes to the block code. The resource I shared above also shares more examples.
-
Thanks. It doesn’t make sense why I should have to convert the block to an HTML block, when the code is correct. Converting it causes me to lose all of the Paragraph block options. But apparently that’s my only option.
-
Hi there! Yes, that’s the best solution in such cases. If you’re comfortable working with HTML, you can add formatting directly via HTML tags. Another option is to convert the block into a Classic Block, which will enable a visual editor with all the options of the old classic editor. I hope that helps :)
- The topic ‘Error: This block contains unexpected or invalid content’ is closed to new replies.