Support

Account

Home Forums General Issues Bi-Directional Relationship repeater fields

Solving

Bi-Directional Relationship repeater fields

  • I am trying to create a Bi Directional Relationship from a ACF Group that contains multiple repeater fields. I have tried John A. Huebner’s Post-2-post and the functions.php code on the ACF site but I don’t think they are designed to work with repeater fields. I have detailed the setup I have below, hoping someone may be able to help 🙂

    I am developing a History site, where I am trying to create relationships between people, places, things events etc. Because there can be many types of relationships and many things related to the same thing (think sibling relationships, builders of a bridge etc) I thought creating a series of repeater selects and repeater Post Objects would be the best way. I have it working well on teh site but I just want the relationships to be update automatically and do away with entering each relationship manually which would be very time consuming and open to errors and omissions.

    Field Group:
    Relationships

    Fields (Type – Repeater):
    – Related People
    – Related Places
    – Related Things…

    Related People Sub Fields:
    – (Type – Select) Relationship: ‘Brother of’, ‘Siling of’, ‘Associate of’ etc
    – (Type – Repeater) Related Person
    – Sub Fields:
    – (Type – Post Object) Related Person

    Related Places Sub Fields:
    – (Type – Select) How Related To Place: ‘Owner of’, ‘Associated with’, ‘Resided at’ etc
    – (Type – Repeater) Related Place
    – Sub Fields:
    – (Type – Post Object) Related Place

    Related Things Sub Fields:
    – (Type – Select) How is Thing related: ‘Associated with’ etc
    – (Type – Repeater) Related Thing
    – Sub Fields:
    – (Type – Post Object) Related Thing

  • As far as I know there isn’t a way to create bidirectional relationships in repeater sub fields, or at least I’ve never seen it done successfully, and would be even more difficult with nested repeater.

  • Thanks John for your reply. I just wanted to check to see if there was a better way of setting up these relationships a bit more automatically which would make things faster and also cut back on input errors 🙂 Looking at my situation could you recommend a better way to achieve this?

  • I have been looking at and thinking about this and to be honest I don’t see any way within WP and ACF to do what you’re looking for.

    If I had to do this I would likely abandon the idea of having bidirectional relationship fields. Instead I would store the information in a way that would make it easier to do a reverse relationship lookup.

    See my most here https://acfextras.com/dont-query-repeaters/

    In this case I would create a standard WP field that held every relationship (post ID) added to the post where your repeaters are located. Then I could use this single post mata field to do the reverse query.

  • Hi John, thanks so much for your reply. I have read your articles and your possible solution above. I think I need to re-read a few times to try and get my brain around the concept. I think I get it and will try and put it into practice.

    Thanks again for your continued help, you’re a champ!!

  • Hi John, I find myself in a similar quest as bradpicko; the link you shared to acfextras.com seems to be down and no cache can be found on archive.org nor google would you happen to have a copy somewhere of that post content? Thanks in advance for any help you can provide

  • Oh Thanks! I couldn’t find it there; thank you!

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Bi-Directional Relationship repeater fields’ is closed to new replies.