Navigation überspringen

[Gelöst] We are trying to use a single taxonomy across multiple CPTs

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 3 years. 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.

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Steven vor 3 years.

Assistiert von: Christopher Amirian.

Author
Artikel
#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 versteckter 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 versteckter 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 versteckter 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
Unterstützer

Sprachen: Englisch (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!