Hello,
I would like to create a relationship between multiple CPTs but from what I can gather post relationships seem to be limited to 2 CPTs?
I have 3 different CPTs, let's say "CPT-1", "CPT-2" and "CPT-3".
I am planning to create another new CPT called "Offers".
I would like to be able to link an "Offer" to multiple CPTs and vice versa. So for example, I have an offer called "Offer A", I would like to be able to link it to a post in "CPT-1", a post in "CPT-2" and a post in "CPT-3". And these posts may be linked to multiple "Offers".
Is this possible? Or would it be case of setting up a number of separate many-to-many relationships?
Essentially what I would like to do is have the "Offers" show up on the single post pages for "CPT-1", "CPT-2" and "CPT-3" (using the example above "Offer A" would show on the linked post in "CPT-1", the linked post in "CPT-2", and the linked post in "CPT-3"). And then the single post page for "Offer A" would show the linked posts from "CPT-1", "CPT-2" and "CPT-3").
Hope that makes sense.
Many thanks,
Joel
Hi Joel,
Thank you for contacting us and I'd be happy to assist.
Your understanding is correct and to achieve this, you can create many-to-many relationships between the "Offers" and the other CPTs.
- CPT-1 <-> Offers
- CPT-2 <-> Offers
- CPT-3 <-> Offers
This will allow you to show the related offers on each single post page of those other CPTs ( i.e. "CPT-1", "CPT-2" and "CPT-3" ).
regards,
Waqar
Thanks Waqar for confirming the correct approach to take.