PR #129 fixed Press This so newly authored posts no longer emit a <figure> className that fails Gutenberg's core/embed block validation. But posts authored before that fix still have the buggy class list stored in their content:
<!-- wp:embed {"url":"...","type":"video","providerNameSlug":"youtube"} -->
<figure class="wp-block-embed is-type-video is-provider-youtube">
<div class="wp-block-embed__wrapper">https://www.youtube.com/watch?v=…</div>
</figure>
<!-- /wp:embed -->
The save() output for those attributes adds a fourth class (wp-block-embed-youtube) that the stored figure is missing. When such a post is opened in the standard Gutenberg editor (wp-admin/post.php), block validation fails and the block shows "Block contains unexpected or invalid content / Attempt recovery" instead of the embed.
Confirmed:
- core/embed's
deprecated array doesn't cover this exact mismatch (it expects extra classes, not missing ones).
fix-custom-classname only repairs extra unknown classes, not missing standard ones.
- Press This users typically don't reopen drafts in Press This — they continue work in the standard editor — so the fix needs to live in (or before) the standard editor's parse path.
Possible directions
- Migration command. A WP-CLI command (or one-shot admin notice with a "Repair" button) that scans posts for the broken pattern and rewrites the className to match save() output. Targeted, explicit, no surprise.
- Server-side filter on
the_post / pre-render. Detect the buggy shape on read and fix it transparently. Lower friction, but rewrites without a clear log.
- Document and rely on Attempt Recovery. Tell users to click the recovery button when they see the banner. Zero engineering, lots of toil.
I'm leaning toward option 1. Open to other ideas before deciding.
Reference: original validation bug fixed in #129.
PR #129 fixed Press This so newly authored posts no longer emit a
<figure>className that fails Gutenberg'score/embedblock validation. But posts authored before that fix still have the buggy class list stored in their content:The save() output for those attributes adds a fourth class (
wp-block-embed-youtube) that the stored figure is missing. When such a post is opened in the standard Gutenberg editor (wp-admin/post.php), block validation fails and the block shows "Block contains unexpected or invalid content / Attempt recovery" instead of the embed.Confirmed:
deprecatedarray doesn't cover this exact mismatch (it expects extra classes, not missing ones).fix-custom-classnameonly repairs extra unknown classes, not missing standard ones.Possible directions
the_post/ pre-render. Detect the buggy shape on read and fix it transparently. Lower friction, but rewrites without a clear log.I'm leaning toward option 1. Open to other ideas before deciding.
Reference: original validation bug fixed in #129.