Home Forums General Issues Nested Relationship Backward query Reply To: Nested Relationship Backward query

  • I don’t think that a bidirectional relationship field here is really what you need. Making a bidirectional field implies that when you are editing the cast member you can select what productions they are in, which would mean another repeater field so that you can also enter character names on the member page and there would also need to be a way to check these two repeaters to make sure that these 2 repeater field match up. This is all possible, but difficult and probably overkill for what you want to do.

    Instead I would not use an ACF field on the cast member side. I would use a standard WP meta field. Still not all that easy though.

    I don’t have code, and I don’t know of any existing code to use as an example, but this would work similarly to a by directional field. The difference is that you’d need to use an acf/save_post filter with a low priority (<10) so that you can compare the old rows of the repeater with the new rows. You’d need to figure out what relationships need to be removed and which need to be added. Then you’d need to get each of the member posts and update the value on the other end.