ACF Chat Fridays offer an incredible opportunity to meet with other users and the ACF development team. Each session answers your questions about the best way to build WordPress sites with ACF, and provides insight into new features coming to the plugin.
The July 21st session included a demo on how to create bidirectional relationships directly in ACF, a new feature set to release in ACF 6.2. In addition to other enhancements, the new release will add an “Advanced” setting tab to the Relationship, Post Object, User, and Taxonomy fields, allowing you to establish bidirectional relationships by flipping a toggle.
Co-hosted by Iain Poulson, Anthony Burchell, and Damon Cook.
Sign up for the next session →
Watch the session in the player below, or catch the highlights and Q&A in the session summary.
Iain Poulson kicked off the session with a discussion of how bidirectional relationships will work in ACF 6.2, without the need to code or use a third-party plugin. He also noted that ACF 6.2 is getting close to its beta release. You can sign up for beta releases and news here.
Some field types in ACF allow you to create relationships between data objects such as posts, pages, custom, post types, taxonomies, and users. You can do this with the Relationship field, of course, but you can also set up these relationships with the Post Object, User, and Taxonomy fields.
Currently in ACF, when you’re editing a post, custom post type, or any other sort of data object that includes a field group with at least one of these fields, you can form a relationship from Post A to Post B, Post C, etc., through a dropdown menu.
This will store some metadata on the data object you’re editing (Post A) indicating that it’s related to Post B, C, D, and so on. This is a very useful feature, but it’s a one-directional relationship, as the data is only saved on Post A. In many scenarios, you want Post B to know that it’s connected to Post A, with the relationships stored on both posts. A bidirectional relationship of this type makes it easier to query and display data.
It is possible to do this in ACF right now, by adding a function to hook into the acf/update_value filter so that when you save on Post A, it essentially takes that relationship and saves it on all the other posts for which you’re selecting that relationship.
This works, but it can be distracting to drop out of ACF in the middle of creating a field group, make the necessary code changes, and then go back into creating your field group. ACF 6.2 brings the process directly into the plugin’s UI, making it much easier to create bidirectional relationships.
During the demo, Iain showed how to use ACF 6.2 to populate a “Related Posts” section, one of the more common uses for bidirectional relationships. He noted that ACF 6.2 adds a new “Advanced” tab to the relational field types, allowing you toggle on a bidirectional relationship. You can see the demo here.
The next session of ACF Chat Fridays takes place August 4th. As always, please feel free to reach out to us on Twitter.
Every ACF Chat Friday gives you the opportunity to ask the ACF team questions about technical challenges and the best way to achieve a specific objective. We’ve included just a few of the questions and answers below. Minor edits have been made for clarity and style.
Q: What are your intentions in regards to moving things over from code to more of a “power user” standpoint in the backend? I work for a niche agency where we build highly customized sites, and it’s great for us to have all these different relationships, custom post types, and so on available in the back end, so we can just click through in the UI instead of doing it in code, and it makes the theme a lot cleaner. But I’m wondering what the intentions are. Are you coming at this from the perspective of a developer, or from that of a power user?
A: We’re definitely not leaving developers behind, but we do want to make it easier for everyone to use ACF. In the case of recent and upcoming enhancements like custom post types and bidirectional relationships, it’s a case of filling in gaps in the workflow that are often filled with other tools.
Custom post types are a great example of this. Creating new post types is often the first thing that many people will do when building a new site, followed by creating custom fields. We wanted to make that as smooth as possible. As of ACF 6.1, you can simply create your post types within the plugin, then add fields to the post type. You can then generate JSON or PHP code from what you’ve created in the UI, to collaborate and commit to version control. The new UI way of registering data also supports JSON sync.
Obviously, you can still do this in code, whether that’s JSON or PHP. We’re not favoring one or the other, but we are trying to make the whole process easier for everyone.
The next session of ACF Chat Fridays is scheduled for August 4th, 2023, at 2pm GMT.
We share relevant resources during the call. We’ll sum them up here and try to provide a bit of context:
Join us on August 4th for the next session of ACF Chat Fridays. This session will take place at 2pm GMT.
What do you think we should cover in upcoming sessions? Let us know what you’d like to see on Twitter.
Sign up for the next session of ACF Chat Fridays here:
https://wpeng.in/acf-chat-fridays/
The list of upcoming sessions is below.
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.
Speed up your workflow and unlock features to better develop websites using ACF Blocks and Options Pages, with the Flexible Content, Repeater, Clone, Gallery Fields & More.
For plugin support, please contact our support team directly, as comments aren't actively monitored.