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.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users