Support » Developing with WordPress » CPT and hierarchical Taxonomy in same slug

  • I have posts with this structure:

    • – Collection (Taxonomy > Term)
    • – – Book (Taxonomy > Child Term)
    • – – – Poem (Custom Post Type)

    and want this URL structure: (archive of ‘poem’ CPT) (archive of ‘collection’ taxonomy) (archive of ‘book1’ term) (show the ‘poem1’ post)

    CPT and taxonomy settings:


        'public'             => true,
        'publicly_queryable' => true,
        'exclude_from_search'=> false,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => array( 'slug' => 'poem/%collection%', //leaved field blank and custom slug sets with plugin
                                       'with_front' => false),
        'capability_type'    => 'post',
        'has_archive'        => 'poem',
        'hierarchical'       => false


        'public'             => true,
        'hierarchical'       => true,
        'query_var'          => true,
        'rewrite'            => array( 'slug' => 'poem',
                                       'with_front' => false,
                                       'hierarchical' => true )

    I created ‘collection1’ in collection taxonomy then created and set ‘book1’ as child of ‘collection1’. Also ‘poem1’ created and ‘book1’ set as term.

    Now I have the url structure that I want but ‘poem1’ (or any posts in this CPT) get 404 Not Found error. I searched and tried almost all of the solutions… but doesn’t work.

    When I change the taxonomy slug to different with CPT slug (=poem), post’s links work correctly.

    CPT and taxonomy created with Pods Plugin and custom permalink for CPT created with Custom Post Type Permalinks Plugin.

  • The topic ‘CPT and hierarchical Taxonomy in same slug’ is closed to new replies.