You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Page sources drop className from the saved HTML of static core blocks #196
A file-backed page (pages/<name>/index.php) that sets a custom class on a core block saves the class in the block's comment attributes but not in its HTML. Static blocks render from their saved HTML, so the class never reaches the front end. The block editor also flags these blocks as invalid, because the saved HTML doesn't match the attributes.
do_blocks() on that output renders <p class="wp-block-paragraph">Hi</p>, <div class="wp-block-group …"> and <h2 class="wp-block-heading">, all without the custom classes.
Expected
className is added to the block's wrapper element in the saved HTML, as the editor's save() does: <p class="b">, <div class="wp-block-group ledger-x">, <div class="wp-block-button is-style-outline">.
A class on a mapped HTML element (<p class="a">, <h2 class="t">) becomes className and stays in the HTML, as the docs already describe for lists ("A class on a list or an item becomes its className").
Also seen
Serialized block markup (<!-- wp:… -->) in a page source is parsed as plain HTML. Its comment attributes are dropped, a core/query turns into an empty group, and Blockstudio blocks written as comments disappear. If that is intended, the Content Sources docs could say so. A raw or serialized passthrough would let existing patterns move into page files unchanged.
Core block classes now survive in both the block attributes and saved HTML, including mapped elements, groups, and button styles. Sources containing serialized WordPress blocks also preserve their attributes, nested blocks, and dynamic blocks instead of being reparsed as HTML.
For existing file-backed pages, run wp bs pages sync once after upgrading to regenerate the saved markup. Unchanged sources are reparsed once for this parser upgrade; locked pages and sync: false remain protected. No automatic request-time sync was added.
Regression coverage includes frontend rendering, Gutenberg block validation and saving, serialized-source preservation, and the repair-once migration. Full CI and distribution checks passed. Thanks for the detailed reproduction.
Activity
dnnsjsk commentedon Nov 4, 2026
Fixed and released in 7.7.12, included in ff1b433.
Core block classes now survive in both the block attributes and saved HTML, including mapped elements, groups, and button styles. Sources containing serialized WordPress blocks also preserve their attributes, nested blocks, and dynamic blocks instead of being reparsed as HTML.
For existing file-backed pages, run
wp bs pages synconce after upgrading to regenerate the saved markup. Unchanged sources are reparsed once for this parser upgrade; locked pages andsync: falseremain protected. No automatic request-time sync was added.Regression coverage includes frontend rendering, Gutenberg block validation and saving, serialized-source preservation, and the repair-once migration. Full CI and distribution checks passed. Thanks for the detailed reproduction.