Hi everyone,
I’ve been suck on this for a couple days, and its such an integral part of the project I thought I’d ask for help.
I have read through the guide here on bi-directional relationships, but I can’t get it to work. I’m not great with PHP, I just know enough to get by ;). That probably has created my problem, but I feel like if someone could point me in the right direction, I could make it work.
Here’s my setup.
I have a CPT called “People”. I have a field group for this custom post type which holds a ‘group’, fieldname whp_parents and a repeater, fieldname ‘spouses’. Basically, I need bidirectional relationships between parents, spouses, and children. So, if I add a child to a person, they are automatically added as a parent, vise versa and etc.
In the whp_parents group, I have a post object for ‘father’, and a post object for ‘mother’, which need to relate to the ‘children’ post object in the ‘spouses’ repeater. (I have a field in a different group for gender, which will help me determine whether to add a person as a father or mother.)
In the ‘spouses’ repeater, I have a group ‘spouse’ for the spouse information. In that group I have a ‘spouse’ post object. (I know, confusing. I should have named them differently.) Since this is relating to a field of the same name, I feel like this one shouldn’t be as difficult, but the repeater is throwing me for a loop.
Children are also in the ‘spouses’ repeater, under a post-object field (will return an array for multiple children of a marriage).
I’m not sure if its all of the different fields that have to work together that has me so confused, or if its because of the repeaters and arrays, but I am completely stuck.
I would be more than grateful for any hints, tips, logic, or other knowledge anyone could share. Thanks!
I am having same issue, would love to know if you had any success with getting it to work?
It is not possible as far as I know to create bidirectional relationship fields in a repeater. This other plugin also has this feature but I do not know if they are able to do this either.
The topic ‘Bi-directional fields with repeaters in groups?’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.