Understanding ACF’s Upcoming Bidirectional Fields
If you follow ACF release news, you may have heard that bidirectional fields are a feature planned for ACF 6.2, along with other great new features like simplified registration of options pages and supporting multiple JSON save paths. While bidirectional relationships have been achievable with custom code for awhile, they may have flown under your radar since it wasn’t easy to implement like the upcoming field setting.
Normal ACF Field Behavior vs. Bidirectional Field Behavior
A normal relationship ACF field assigned to an item allows you to associate another item with it. You can use relationship fields across different post types. For example, you could have a Movies custom post type and an Actors custom post type and use a relationship field on the Movies custom post type to choose the actors in said movie. You’re linking one item to the other.
You can use them within the same post type, as well. For instance, while related posts are often determined by pulling items within the same category or tag, you may have a related post override relationship field where you can custom curate the posts that appear in a related section for any given post. Let’s say you have an in-depth series that was spread across a few separate blog posts, you may want the posts suggested in each of these blog posts to be the other posts in that same series vs. the newest ones in the same category.
With a standard ACF relationship field, without doing any custom functions, you’d need to make those connections on each post individually. So if Post A should have Post B in its related posts, you would need to edit Post A and select Post B, as well as edit Post B and select Post A.
The Magic of ACF Bidirectional Relationships
Starting in ACF 6.2, you’ll be able to toggle a bidirectional setting on which will sync the relationship across these items automatically in a field. So if you have made a Custom Related Posts relationship field and toggled the bidirectional setting on, if you edit Post A and say that it’s related to Post B, Post B will automatically show that same relationship, showing Post A in its related posts, without requiring it be individually edited. You could also remove Post B from the field on Post A and Post B would no longer show it is related to Post A, as well.
An easier way to think of it is the relationship itself is synced across whatever items you select in a bidirectional field. You can modify the relationship from any individual item and it will impact it globally across the selected items.
Bidirectional Fields Will Be In ACF 6.2
ACF 6.2 is expected to be released in the next few weeks where you’ll find the option to make a field bidirectional under the Advanced tab of a field’s settings, if the field type supports it. Post Object, Relationship, User, and Taxonomy fields will have bidirectional support. If you want to test the Beta 1 release and provide the amazing ACF development team any feedback, check out their release post here.