Problem:
How to programmatically connect posts using a post reference field.
Solution:
There is some duplication with the post reference field, it is stored both as post meta (using wpcf-field-slug as key) but also in the associations table Toolset manages post relationships with, and so as well as setting the post meta value it is also necessary to use toolset_connect_posts to join the posts. (The first argument is the slug of the post relationship field.)
I have two cpts in a many-to-many relationship, Doctor and Office (no intermediate post-type, in case it matters). Most Offices have only one Doctor, though some have 2-4.
I want to display an IMG tag on (and, ideally, filter/prioritise in search) Offices where at least one Doctor has either a checked field or a taxonomy item "Certified Member"
Solution:
In a single "Office" post, you can create a post view:
1) Query "Doctor" posts,
2) Filter by:
- the post type relationship between post type Doctor and Office