• Resolved John

    (@hollowstar1)


    Hi,

    I have a pretty complex question about Custom Post Types and Taxonomies.

    We have a Custom Post Type for our case studies, which is set up as follows:
    Post Type Slug: content_market
    Custom Rewrite Slug: work
    As a result, these case studies have URLs as follow:
    example.com/work/case-study-1, example.com/work/case-study-2,
    etc.

    Now I’m supposed to create categories (or hubs) for these case studies, and achieve this structure:
    example.com/work/animation/
    example.com/work/ecommerce/
    etc.

    The case studies URLs should remain the same, but each one of these post will be included in one (or more) hub.

    How would you approach this? Should I create a new Taxonomy for the case studies? If so, how do I make these taxonomy URLs to be under /work?

    if I create a Taxonomy with Custom Rewrite Slug: work and Rewrite: true then it does seem to create these categories (like example.com/work/animation works fine), but it then breaks regular CPT posts (such as example.com/work/case-study-1).

    Would you know how I should set this up?

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Definitely a tough spot because once you get to “animation”, “ecommerce” etc, without some fancy-ish rewrite checking, it’s probably going to get considered to be a post in the post type, and not the term slug for a taxonomy.

    I am wondering if this may be a good tutorial to checkout and try.
    https://www.ibenic.com/custom-wordpress-rewrite-rule-combine-taxonomy-post-type/

    Comparing to your example, I believe it’d make the “work” in your desired URL the taxonomy, and then if you follow along, a third part of the url would end up being the post name/slug that you can have WP query by.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom post type and custom taxonomies under same slug?’ is closed to new replies.