WordPress / developer-blog-content

In this GitHub space, WordPress team coordinate content to be published on the Developer Blog. Discussion and montly meetings (first Thu) in WP Slack #core-dev-blog
36 stars 2 forks source link

Block Bindings API (part 1) and connecting custom fields #222

Closed justintadlock closed 4 months ago

justintadlock commented 4 months ago

Discussed in https://github.com/WordPress/developer-blog-content/discussions/219

Originally posted by **justintadlock** February 5, 2024 WordPress 6.5 will ship with a Block Bindings API and the ability to connect custom fields to block attributes. The feature will be in a limited form, but it is a major first step toward handling a feature that extenders have needed for years. In many cases, it will mean that theme authors and plugin devs will be able to use the existing Core blocks to output dynamic data. Resources: - [Connecting block attributes and custom fields](https://github.com/WordPress/gutenberg/issues/53300) - [Block Bindings API](https://github.com/WordPress/gutenberg/issues/54536) I'm thinking the tutorial should at least cover which blocks and attributes can be connected to custom fields and show some examples. A second part of this (though, it may be a separate tutorial) is to show how to register custom binding sources. WP 6.5 should ship with `core/post-meta` and `core/pattern-overrides`, but devs can also build custom sources. ## To test Add a `mood` and `weather` custom field key in your Custom Fields panel. Add any text to the fields. Then, add these blocks to your editor: ```html

``` This is a really basic example, and the post should walk devs through the basics to a more advanced example.
justintadlock commented 4 months ago

This is currently being drafted here: https://docs.google.com/document/d/1LAwj_Gynb_zlvQ_eOMSXriN0gZVJrh6OghjJuBdehms/edit?usp=sharing

justintadlock commented 4 months ago

First review handled by @ndiego.

justintadlock commented 4 months ago

And it's live! Thanks to everyone for getting this post ready.

Social copy:

In WordPress 6.5, plugin and theme developers can bind custom fields to some Core blocks. Learn how in this first post of a two-part series on the Block Bindings API:

https://developer.wordpress.org/news/2024/02/20/introducing-block-bindings-part-1-connecting-custom-fields/