I have two posts, let’s call them post A and B. Now, in post A I have field with name ‘link’ which is ‘relation’ or ‘post object’ type. In this field I’m selecting the post B. Now, on B post I want to display the same field type (so ‘relation’ or ‘post object’) but with reference to post A. It’s sounds complicated, but I need it for this situation:
Post B is a ‘event’ post type. Post A is a product in Woocommerce, ‘event ticket’. On ‘event ticket’ I set which one event this ticket concerns. Then, on post A (event) I want to display ‘woocommerce_single_product_summary’.
How should I do it in the best way?
Use a plugin that creates bidirectional relationships between the two post types or use this example to build it https://www.advancedcustomfields.com/resources/bidirectional-relationships/, then on the event page you can get the relationship field on that end to show the related product.
Or you can do a reverse relationship query as explained here https://www.advancedcustomfields.com/resources/querying-relationship-fields/