I have posts with this structure:
Collection (Taxonomy > Term)
- Book (Taxonomy > Child Term)
- Poem (Custom Post Type)
and want this URL structure:
site.com/poem/ (archive of ‘poem’ CPT)
site.com/poem/collection1/ (archive of ‘collection’
site.com/poem/collection1/book1 (archive of ‘book1’ term)
site.com/poem/collection1/book1/poem1 (show the ‘poem1’ post)
CPT and taxonomy settings:
'poem' '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
'collection' 'public' => true, 'hierarchical' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'poem', 'with_front' => false, 'hierarchical' => true )
I create ‘collection1’ in collection taxonomy then create 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.
Read more here: CPT and hierarchical Taxonomy in same slug