Hi there,
First of all: thank you for the amazing plugin and functionalities. I have a question:
https://www.advancedcustomfields.com/resources/bidirectional-relationships/
I was reading this and I loved the explanation, but I was wondering: how can I get multiple values efficiently?
1 – How does this snippet affect the performance / queries on the post pages?
2 – What is the best way to get multiple fields to be bidirectional? Example: I want a field called X and a field called Y to be bidirectional – can I use the same function in PHP or do I have to duplicate it in functions.php?
1 – one of the reasons for creating bidirectional relationships is to improve query performance. This is done so that you can use get_field() from either side of the relationship rather than doing reverse relationship queries.
2 – Code examples you will finds will require creating mostly duplicated code for every relationship you want to make bidirectional. There are more examples of different ways to do this, some of them can be found here. There are plugins that will do this as well.