Skip Navigation

[Resolved] Displaying Children posts based on Post relationships (many to many) not working

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

Problem: I am trying to display a list of related posts in a many-to-many (M2M) relationship, but it's not working as expected.

Solution: Be sure to use a Post Relationship filter, not a Post Parent filter. Post Parent filter is for a single hierarchical post type, Post Relationships filter is for posts in different post types.

Relevant Documentation:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

This support ticket is created 6 years, 5 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 1 reply, has 2 voices.

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

Assisted by: Christian Cox.

Author
Posts
#909172
03.JPG
02.JPG
01.JPG

hi,
I have a CPT called "Persons". this CPT is related to 3 other CPTs called "Sermons, Articles and books" through many to many relationships.

I am trying to follow this documentation here:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

to create a custom search view to show the books, articles and sermons that relates to a certain person.

I created a view called "Person Material". but all what I am getting is "No posts found".

hidden link

I simplified the view to just "sermons" to try to isolate the problem, but still no luck.

The sermon posts are definitely linked to the person cpt. please check screenshot 01.jpg

The person post is definitely linked to the sermon posts. please check screenshot 02.jpg

The sermon cpt is chosen in the view, and the filter is chosen as "the post where the view is shown", exactly as the documentation:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items
Please check screenshot 03.jpg.

I added the view shortcode in the Person CPT layout and directly to the content. both didn't work.

i changed the condition from "the opst whre the view is shown" to "the post in the loop", but it didnt work too.

so the view is not working even with 1 CPT.

can you please help?

thanks

#909396
Screen Shot 2018-06-06 at 10.36.42 AM.png

Hi, please check now. I have made two changes:
1. Uncheck "Don't include current page in query result". Any time the View and the current page are different post types, I recommend unchecking this box because it can cause unexpected issues.
2. Change the Query Filter from "Post Parent" to "Post Relationship". This can be confusing because the terminology is similar. Post Parent is for hierarchical post types, like native WordPress Pages. Post Relationship is for relationships between different post types. See the documentation here: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items