Article WordPress

Connecting blocks to post meta with the Block Bindings API

Instead of building a custom block to show one field, connect a core paragraph or button straight to post meta.

Hamid Aarab Senior WordPress and WooCommerce Backend Developer
Published
Reading time
1 min read

Hamid Aarab May 5, 2026 1 min read

تصویر پیکسلی یک بلوک متصل به یک فیلد داده
Contents (3)

The Block Bindings API lets attributes of core blocks — a paragraph’s content, a button’s URL — come from a data source such as post meta.

Register the meta with REST access

register_post_meta( 'case_study', 'project_url', [
    'type'         => 'string',
    'single'       => true,
    'show_in_rest' => true,
] );

Bind it in block markup

<!-- wp:paragraph {"metadata":{"bindings":{"content":{"source":"core/post-meta","args":{"key":"project_url"}}}}} -->
<p></p>
<!-- /wp:paragraph -->

For custom sources, register one with register_block_bindings_source() and return the value from anywhere.

Check the list of bindable blocks and attributes for your WordPress version; it has grown release by release.

When to build a custom block anyway

If the display logic is complex or several fields must be combined, a custom block or a server-rendered pattern is still the better choice.

$ ./request_review

Facing the same problem in your own store?

Senior WordPress and WooCommerce backend engineering for complex production problems.

Request a Technical Assessment

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *