30 Apr

ACF Chat Fridays: Using the Block Bindings API

By Mike Davey

ACF Chat Fridays are biweekly open office hours hosted by the developer team. These sessions allow users to engage directly with the ACF team and discuss any questions, feedback, or issues related to the plugin.

The April 26th session of ACF Chat Fridays focused on how to use the new Block Bindings API introduced in WordPress 6.5 with ACF 6.2.8, as well as a discussion of the upcoming beta release of ACF 6.3.

Co-hosted by Iain Poulson, Matt Shaw, Liam Gladdy, Anthony Burchell, and Damon Cook.

Sign up for the next session →

ACF Chat Fridays Banner Image.

Session Recording

You can see the entire session in the player below, or catch the highlights in the session summary.

Session Summary

Iain Poulson got the latest session rolling with the news that ACF had won Plugin Madness 2024, and extended thanks on behalf of the team to everyone who supported ACF with their votes. Iain also noted that the team is putting the finishing touches on ACF 6.3, with the first beta release expected this week. Iain urged participants to sign up for the ACF beta news email list to help test the upcoming release.

In other news, the ACF website has recently undergone a small refresh designed to make the site more accessible to all users. The minty green color used on the site’s hero sections made text more difficult to read. This color has been updated to a dark blue throughout the site.

Iain then introduced Damon Cook of WP Engine’s DevRel team, who took us through a demo of how to use ACF with the Block Bindings API introduced in WordPress 6.5. The Block Bindings API is a means of tying dynamic data to existing blocks and their attributes. This then becomes part of the final markup that’s output to the user’s browser. During the demo, Damon took us through the process of binding the data to block attributes, registering through variations, and then abstracting the bindings in different ways so that it might be surfaced for users. You can skip to that part of the video here.

Q&A

We’ve included some of the questions and answers from the latest session below. Minor edits have been made for clarity and style.

Q: Since you can take the bindings on an ACF Blocks with the Block Bindings API, and then abstract them in different ways, does this replace the need to build separate ACF Blocks for each of these needs? Normally, I’d build an ACF Block for each of these different ACF fields, and then design and populate them in the page or template as I wanted. In a sense, using the Block Bindings API with ACF Blocks seems to replace the need for some of this.

A: Yes and no. Block bindings work by connecting meta to blocks, but that meta is stored on the page or post. The difference with ACF Blocks is that your editor is creating the data while adding the block, and then that data, and the data stored is stored purely for that block. You can connect that global post meta to any block on the page, but custom blocks are still a bit more specific and granular.

Using the Block Bindings API with ACF Blocks isn’t a replacement for creating custom blocks, but it is a way to surface post or page meta in the block editor. Prior to WordPress 6.5, you’d have to install a plugin with the ability to take any piece of post meta from that post and add it in the block, or use the ACF shortcode to render that value as part of the content.

The Block Binding API is a great step forward for WordPress, but it complements ACF Blocks rather than replacing it.

Q: Are there plans to make ACF Blocks feel more like native blocks within the editor?

A: We absolutely want to make everything native, and it’s become clear that we’re going to have to make React components for everything. It’s taking us some time to get the foundation in place and figure out exactly what that will look like, as we need to do it in a backwards compatible way, but we have an understanding of the road needed to get there now.

ACF 6.4 should include what is essentially a modern rewrite of ACF Blocks that will make it much easier for us to develop and build on things faster. Part of that is figuring out a way for fields to give us a React component version of themselves. We can do that for all of the ACF core fields, but we want to maintain compatibility with third-party fields and give them a way to do that as well. We’ve also got some CSS tweaks and plans to try and make everything else feel more native even if it’s still using legacy jQuery.

It’s a long road, but we definitely have a map on how to get there. This time next year, everything will likely look different than it does right now.

We share relevant resources during the call. We’ll sum them up here and try to provide a bit of context:

Coming Up on ACF Chat Fridays

Register today for the next session of ACF Chat Fridays, taking place May 10th, 2024 at 2pm UTC. Questions and suggestions for the development team are always welcome.

Register for the next session of ACF Chat Fridays here:

https://wpeng.in/acf-chat-fridays/

The list of upcoming sessions is below.

  • May 10, 2024
  • May 24, 2024
  • June 7, 2024
  • June 21, 2024

Tag or DM us on Twitter to let us know you’ll be there. Suggest new topics, let us know what you’d like to see, and send us feedback with #ACFChatFridays on Twitter.

About the Author