This block contains unexpected or invalid content 📝 WordPress

WordPress: This block contains unexpected or invalid content. Attempt Block Recovery

The saved HTML of a block doesn’t match what the block’s current save function produces — after a plugin update, manual HTML edits, or content filtered on save.

Seen on: WordPress

Meaning

Gutenberg validates saved markup. Updated blocks without deprecations, editing HTML in the code editor, or security plugins/KSES stripping attributes cause invalid blocks.

Common causes

  • Block plugin updated without deprecation handling
  • HTML edited manually
  • Content filtered by KSES/security plugins (unfiltered_html)
  • Imported content from another site

⚡ Quick fix

  1. Click Attempt Block Recovery
  2. Convert to HTML/Classic block if recovery fails
  3. Update the block plugin; check user capability unfiltered_html

Detailed fix by platform

WordPress

  1. php
    // In custom blocks, add deprecated versions when changing save() output
    deprecated: [{ save: oldSave, attributes: oldAttributes }]

How to diagnose

  1. Block — Which block type?
  2. Change — Plugin update or manual edit?
  3. Role — unfiltered_html capability?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.