Skip Navigation

[Resolved] View Query Filter doesn't work on Intermediary Post Custom Field

This support ticket is created 5 years, 2 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.

This topic contains 1 reply, has 2 voices.

Last updated by Beda 5 years, 2 months ago.

Author
Posts
#1527711
Screen Shot 2020-02-26 at 00.29.08.png

I am trying to: Filter a view by using an intermediary post custom field

Link to a page where the issue can be seen: hidden link

I have created a many-to-many relationship between post types 'Insights' and 'Reports'. That relationship has an intermediary post type 'Insights - Report' with custom fields. I am trying to query specific posts of the post types 'Insights' through a custom field 'Insight-Stage'.

I expected to see: One item in the view which has 'Stage 2' selected in the intermediary post 'Insights - Report'.

Instead, I got: No items.

This is an issue I've had on another site also, not being able to query by intermediary post custom field.

Many thanks for your help!

#1528107

This is not possible, you cannot query a Post Type by fields of another post type, even if its a related post type.
You can query by that related Post type, but not by its fields, and only by one relationship tree a time, each View.

You would have to add your voice for this feature to be implemented at https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/:
To be able to filter by related posts fields, in an M2M or O2M relationship.

Right now you'd have to query the very post type you want to filter by fields, so in your case, the relationship post.
Then you could add that View to a Post in a relationship and it would display all relationship posts of that related post and you can filter that by the fields.
Then, in the loop, you can display the other related post, passing an item attribute.

Does this help?