Skip Navigation

[Resolved] [A] [B] and [A] [C] many to many relationship problem

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

Our next available supporter will start replying to tickets in about 2.35 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2218923

Hello,

I have 3 CTPs: Resources [A], Solutions [B] and Products [C].

I am trying to setup the relationship so that each [A] can be assigned to multiple [B] and [C]. "Each Resource is referencing multiple Solutions and Products ". And I need [A] to be filterable by [B] and [C]. "Resources should be filterable by Solutions and Products".

I have created many to many relationships between [A] <<>> [B] and [A] <<>> [C]. When creating or editing [A] I am able to connect it to [B] and [C] as intended.

But the problem is that I am not able to setup the filtering for some reason. Once filtering by [B] is setup (and working), I am not able to even add filtering by [C] - the "Post relationship" button is inactive. Here is a screenshot: hidden link
And if I try to copy the [B] filter code and change parameters to [C], the view would through a suggestion to remove the filter from query.

Please let me know where I am wrong with filtering setup and how can this be fixed?

Andrey

#2219353

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Andrey,

Thank you for contacting us and I'd be happy to assist.

Your observation is correct and it is possible to include only a single relationship filter/field in a view.

Can you consider managing either 'Solutions' or 'Products' as a custom taxonomy, instead of a custom post type?

This way, you'll be able to search one of them using the relationship filter and the other one using the taxonomy filter.

regards,
Waqar

#2219437

Hi Waqar,

Managing Solutions or Products as custom taxonomies would be possible only if there is a way to automatically sync taxonomy records with related CPT. Otherwise I would need to manually update taxonomy records each time a Product/Solution is added or removed.

Do you have any suggestions for this?

Andrey

#2221379

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

As there is no straightforward feature or workaround available to keep the CPT posts and custom taxonomy terms in sync, this setup can further add to the complexity and become difficult to manage, in the long run. I wouldn't recommend using the CPT and custom taxonomy, both at the same time, for storing the same elements.

Is there any specific reason, you'd want to keep CPT for 'Solutions' and 'Products'? While using taxonomy terms, you can use the single term's archive page, as a replacement for the single CPT page and you can add term fields with taxonomy terms similar to how custom fields can be added with CPT posts.

I'm sorry if it sounds like I'm pushing the idea of using a custom taxonomy. It's just that, I can't think of any other efficient and reliable workaround/alternative available for the requirement, that you've shared.

#2221593

To answer your question "Is there any specific reason, you'd want to keep CPT for 'Solutions' and 'Products'?"

Both 'Solutions' and 'Products' have their own pages and they are key to our business. Both are being added/edited/removed frequently. Both don't fit the limited capabilities of taxonomy format.

'Resources' (webinars, ebooks, downloads, etc) reference 'Solutions' and 'Products' and the reason why I need this many-to-many relationship is I want my users to easily navigate to related 'Solution' or 'Product' from a 'Resource' page.

#2222391

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing these details, and in light of this, it makes sense to keep the CPTs for 'Solutions' and 'Products'.

The only other workaround I can think of is to add two separate and independent views, side-by-side, on your search page. One can provide the option to search 'Resources' by 'Solutions' and the other can provide the ability to search 'Resources' by 'Products'.

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