Skip Navigation

[Resolved] I need to relate posts of the same type

This support ticket is created 6 years, 3 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 6 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1110732

I am trying to relate posts of the same type.

Instead, it grays out the post type I selected first in the second selection, making it impossible to select the same post type twice.

Practical use: I'm making a custom post type that needs to relate to other posts of the same type, so that post detail pages can show other related posts of that type, similar to how WooCommerce products can relate to other products. Why can't I do this? If I can, how? I'm going to create a custom taxonomy for this custom post type, but that won't be the same thing as a related post that I want to show on the detail pages.

#1110736

Hi, there's no built-in way to relate posts from the same post type using post relationships or post reference fields. The best way to relate posts in the same post type is to use a custom taxonomy specifically for these relationships. Basically it involves using custom taxonomy terms that correspond to each post's slug, then using a View of posts filtered by term slug to show the related posts. I explained the details of this process in another ticket you might find helpful: https://toolset.com/forums/topic/link-inside-post-type-to-other-post-of-the-same-type/

There are other options like using a repeating custom field to store the IDs of related posts. I consider that approach more difficult to manage because the ID of each related post isn't obvious. The slug can be determined by checking the post URL.

#1110744

Both options are poor user experiences for the person editing the site, but thank you for the very quick response.

I'm curious, why don't you allow users to reference the same post type? What's the technical reason for the limitation? It would have many practical uses to allow it.

#1111510

Supporting relationships between posts of the same post type is on our roadmap, but we don't have a delivery timeline available yet. It was part of the initial plan for post relationships, but there were unexpected roadblocks to implement this feature in time for the main post relationships release. The technical reasons are not explained to supporters, but they were complex enough to warrant additional investigation and development work based on the information I have been given. Rather than delay the other aspects of the release, this feature was held back for a future release.