Repository navigation
Description
Blockstudio registers each of a block's attributes individually on the WP_Block_Type — they appear in WP_Block_Type_Registry with a type and a default — but render() reads none of them. Only values nested under the blockstudio attribute are used.
For a human in the editor this never surfaces, because the editor always writes the nested shape. It surfaces the moment anything writes a block programmatically: the REST API, WP-CLI, a content migration, or an MCP server. The registry is exactly where such a writer looks to discover what a block accepts, so it reads a public schema that turns out to be inert.
Where
includes/classes/block.php, ~line 1824 (v7.6.9):
$attributes = array_merge(
$attr, // defaults
$attributes['blockstudio']['attributes'] ?? array()
);Defaults, then only the nested payload. Anything at the top level is dropped before transform_attributes() ever sees it.
Repro
With any Blockstudio block that has a select — here one with visual_type offering webgl (default) and media:
// Ignored — renders the `webgl` default.
$flat = '<!-- wp:acme/hero {"visual_type":"media"} /-->';
// Honoured — renders `media`.
$nested = '<!-- wp:acme/hero {"blockstudio":{"attributes":{"visual_type":"media"}}} /-->';
echo do_blocks( $flat );
echo do_blocks( $nested );visual_type is present in WP_Block_Type_Registry::get_instance()->get_registered( 'acme/hero' )->attributes in both cases.
Why it's worth a look
The failure is completely silent. The post saves, parse_blocks() round-trips the attribute byte-identically, the editor opens the block without a validation notice, and the block renders its default. There is no error, no warning, and no way to notice except rendering the block and comparing the output against what you sent — which is how we found it, after confirming against block.json that the value we'd sent was a valid option.
Possible resolutions
-
Merge top-level attributes as a lower-priority source, so an explicitly nested value still wins:
$attributes = array_merge( $attr, array_intersect_key( $attributes, $attr ), $attributes['blockstudio']['attributes'] ?? array() );
array_intersect_keyagainst the defaults keeps this scoped to ids the block actually declares, so it cannot pick upanchor,classNameor anything else WordPress owns. -
Or stop registering the individual attributes on the
WP_Block_Type, so the registry stops advertising a schema that isn't read.
Either makes the behaviour discoverable. (1) is backward compatible as far as I can tell — every block the editor has ever saved carries the nested shape, so the new branch only fires for attributes that are currently being discarded.
Happy to open a PR for (1) if that's the direction you'd prefer — just say which.
Workaround, for anyone who lands here
Nest on write. We normalise in our MCP layer: move every id the block declares under blockstudio.attributes, leave WordPress's own attributes (anchor, className, lock, metadata, style, align) at the top level, and let an explicitly nested value win over a flat one of the same name.
Version: blockstudio/blockstudio v7.6.9, WordPress 7.x, PHP 8.3.
Activity
dnnsjsk commentedon Sep 9, 2026
hmm, i think 1 makes more sense. 2 is a breaking change.
PR welcome @elliottmangham
elliottmangham commentedon Sep 9, 2026
PR #91 opened 👍
Read block attributes written at the top level
Merge PR #91: read block attributes written at the top level
Document and log top-level block attribute reads [all]