Skip Navigation

[Resolved] Reasons to create intermediary post type on many-to-many relationships?

This thread is resolved. Here is a description of the problem and solution.

Problem:
When creating a many-to-many relationship why would you create an intermediate post type?

Solution:
If you want to store relationship fields (e.g. if you are connecting doctors and patients, the appointment time would be stored separately for each connection, not on either the doctor or patient posts) then the intermediate posts are used to store them.

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by joe-enteleos 5 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#1112107

Hello,

I have several custom post types, one of which is Notes. Each Note post may refer to multiple posts of several different types, and each post of these other types may refer to multiple Notes. I expect to compile links or full-text for the relevant Notes in views of these primary posts, and compile lists of referenced posts in views of each Note.

My question is, what is the advantage of creating an intermediary post type for this relationship? It doesn't seem to me that I would need it. Could you tell me what circumstance or need might make this necessary or useful?

Thank you in advance.

#1112194

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Joe

The intermediate post type is required if you want "relationship fields".

In the classic example of bands appearing at festivals for which you have a many-to-many relationship, you'll want to record the date & time of the appearance(s). You wouldn't store it on either the event or the band post, but need to record it for the specific connection representing the appearance of a band at some festival.

So an intermediate post is created to store that post meta.

That's all there is to it.

#1112273

Thanks for clarifying, Nigel. I appreciate it!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.