Home › Forums › General Issues › Add taxonomy terms to custom post type from posts in relationship field › Reply To: Add taxonomy terms to custom post type from posts in relationship field
This isn’t something I’ve ever tried before, but it would mean having a priority of < 10 on the filter so that you can compare the current value of the relationship field with the previous value of the relationship field.
There is an example of doing this for biderectional relationship fields https://www.advancedcustomfields.com/resources/bidirectional-relationships/
But the problem is that you’re dealing with terms, so more than one relationship would be involved. The same terms could be added by other relationship fields.
So I would amend my previous steps. First off you would need to set up a bidirectional relationship field. You would also need to check all of the posts that are related to all of the posts in the relationship field 2 steps away
current post => relationship field => related posts relationship fields
to figure out what should be added/removed.
Thinking about it makes my head hurt a bit. I’m sure it’s possible but would take me several hours to work out the details.
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.