Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
justintadlock opened this issue Feb 14, 2024 Discussed in #219 · 3 comments
Closed

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

justintadlock opened this issue Feb 14, 2024 Discussed in #219 · 3 comments

Comments

@justintadlock
Copy link

Discussed in #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:

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:

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

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

This is a really basic example, and the post should walk devs through the basics to a more advanced example.

@justintadlock
Copy link
Author

@bph bph added the flow: approved can move forward label Feb 15, 2024
@justintadlock justintadlock changed the title Tutorial on WP 6.5's Block Bindings API and connecting custom fields Block Bindings API (part 1) and connecting custom fields Feb 19, 2024
@justintadlock
Copy link
Author

First review handled by @ndiego.

@justintadlock
Copy link
Author

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Published (Done)
Development

No branches or pull requests

2 participants