Skip Navigation

[Resolved] We are trying to use a single taxonomy across multiple CPTs

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

Problem:
I am trying to use a single taxonomy across multiple Custom Post Types (CPTs), but the URL structure doesn't work properly. Specifically, I need to filter by post type "transactions", but the URL is not reflecting the post type and WordPress doesn't seem to recognize it.

Solution:
Avoid using WordPress default taxonomy archive pages. Instead, create separate views for each custom post type regarding the taxonomy. In the view, create a custom search that filters the taxonomy for a specific custom post type, ensuring that only filtered terms within that custom post type are displayed. Note that you will need to create a separate view with search functionality for each custom post type.

Relevant Documentation:

https://toolset.com/course-lesson/creating-a-custom-search/

This support ticket is created 2 years, 9 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 2 replies, has 2 voices.

Last updated by Steven 2 years, 9 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2616585

We are trying to use a single taxonomy (industries) across multiple CPTs (transactions, research, insights, etc.) That part is setup the problem is we also have taxonomy pages like this one hidden link which currently is a taxonomy only for transactions but when moving to a single taxonomy this URL structure doesn't seem to work the URL becomes hidden link and WordPress has no idea about the post type "transactions" that I would like to filter. Is this something creating a View can help with?
Currently for example on this page hidden link the dropdown links are generated from the taxonomy so I'd need to generate proper URLs if this is even possible to do as I've tried to explain.

Thank you for your time,
Steven

#2616733

Christopher Amirian
Supporter

Languages: English (English )

Hi Steven,

Sharing a taxonomy with multiple CPTs has that downside as the default WordPress taxonomy archive page does not take CPTs into consideration and it will list all taxonomies with the term in question no matter which CPT they are part in.

For your use-case I suggest that you avoid using the WordPress archives and create separate views for each custom post type regarding the taxonomy in question.

In the view, you will be able to create a custom search that filters the taxonomy but as the view content is limited to a custom post type, it will only show the filtered terms within the custom post type:

https://toolset.com/course-lesson/creating-a-custom-search/

The downside of this method is that you will need to create a separate view with all the search functionality for each custom post type.

Thanks.

#2617461

My issue is resolved now. Thank you!