Tool

WordPress Gutenberg Markup Checker

Validate Gutenberg block comments, JSON attributes, and WordPress shortcodes after a post is translated. Catch invalid markup before it is imported back into the editor.

100% client-side: Your files never leave your browser.

0 B
0 B
Paste a WordPress post, or load the broken sample.
Reference

Why WordPress Shows "This block contains unexpected or invalid content" After Translation

Gutenberg stores each block as an HTML comment plus a rendered wrapper. A heading comment carries JSON such as {"level":2}. WordPress parses every comment and checks that the wrapper still matches those attributes. If the JSON cannot be read, or the wrapper class no longer matches, the editor reports invalid content. Attempt Block Recovery then drops attributes it could not trust.

A translator or a language model often treats that short JSON as a sentence. Straight quotes become curly quotes, which JSON rejects. A comma disappears, or an entity such as " replaces a quotation mark. Posts sent through the WordPress REST API need the same check on content, since a successful save does not prove the block tree will open.

align, className, id, sizeSlug, and level are API names. Replacing align with a translated word leaves the div on a class such as alignwide while the comment no longer describes that class. A paired block that loses <!-- /wp:columns --> never finishes. A separator or synced pattern uses /--> and is already complete.

Shortcode tags and attribute names are registered in PHP. Translating gallery, or translating id, means the plugin does not recognize the tag after import. Text fields such as alt, caption, label, placeholder, title, and content may change. Keys, numbers, booleans, and technical strings may not.

Gutenberg Elements Reference Table

The comment is the source of truth. Inner HTML is the saved wrapper.

ElementWhat it storesWhat may change
<!-- wp:name -->Block typeNothing in the name. Visible text may change.
JSON attributesKeys and values on the commentKeys and numbers stay. alt, caption, and content may change.
<!-- /wp:name -->End of a paired blockThe name and the nesting order stay.
/-->A finished void blockThe slash stays. There is no separate closer.
[shortcode]Plugin tag and attribute namesValues may change. Tag and attribute names stay.
Inner HTMLWrapper tags, classes, and copyVisible text may change. Classes such as alignwide must still match the comment.

FAQ

Can a bulk WordPress REST API script validate Gutenberg markup before the draft is saved?

The posts endpoint stores content as a string. A successful write does not prove the block tree will open. Invalid JSON, a missing closer, or a translated shortcode still imports.

Why do translators break {"className":"..."} during a post translation?

className is a CSS hook, not a sentence. Rewriting every quoted string renames the key or the class, while the wrapper keeps the original class. Leave className, align, sizeSlug, slug, and type unchanged.

How should reusable and synced pattern blocks be handled?

A synced pattern is the self-closing comment <!-- wp:block {"ref":108} /-->. Translating the numeric ref points at the wrong pattern. Keep the ref and the trailing slash.

What is the difference between a paired block and a self-closing /--> block?

A paired block has an opener, a closer, and wrapper HTML between them. A self-closing block ends with a slash and has no closer. Only a paired block can be left unclosed.

Does this checker upload the WordPress post?

No. Parsing and the report run in the browser. Pasted HTML and dropped files stay on the machine, and nothing is sent to an API.

After the block comments are clean, static HTML can be translated on HTML Translate. Check merge tags with Email Tag Guard. See translating HTML without breaking layout and the tools hub.