For this post I decided to make a video that goes into how to use the Block Bindings API coming out in WordPress 6.5. The most important feature? It works with the Advanced Custom Fields plugin*, which was incredibly helpful when building out the new SiteCare site.
*the big asterisk being, ACF’s image field does not work with the API. That’s because it passes an Image ID to WordPress (not matter how you set the field’s output), whereas the only relevant options the Image block accepts are URL. I believe this is because it’s a static block, so it can’t go out and dynamically find what ID is tied to an image. I’m not sure, though.
Still, it’s exciting stuff! Especially since it works within the Query block. Here’s all you have to do to connect a Paragraph’s content
attribute to an ACF field inside the WordPress Code Editor:
<!-- wp:paragraph {
"metadata":{
"bindings":{
"content":{
"source":"core/post-meta",
"args":{
"key":"mu_acf_key"
}
}
}
}
} -->
<p></p>
<!-- /wp:paragraph -->
Super simple. I don’t believe you have to enable the REST API in your ACF field group either.
You can check out this awesome blog post that goes into depth on how to use the new APIs. There’s also a GitHub issue surrounding the new APIs you should check out.
Leave a Reply