Home › Forums › General Issues › Bidirectional relationship › Reply To: Bidirectional relationship
Sorry, I should have asked that first. I can’t make my plugin work in ACF 4, it only works in ACF 5. The routine that finds the same field for the post that you’re adding to the relationship depends on a function in the Pro version that does not exist it the version you’re using.
I would be possible to build something similar for ACF 4 for a specific field.
This is what it does. When the relationship value is save using the acf/update_value filter https://www.advancedcustomfields.com/resources/acfupdate_value/, the new value of the field is compared to the old value of the field. If there is a difference then updates are made to the related posts. If there was a relationship in the old value that is no longer there then the other post is updated to remove the reciprocal relationship. If there is a relationship in the new value that was not in the old value then the other post is updated to add the reciprocal relationship.
50% of the code in the plugin is just to automatically find the same field on the other post.
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.