Hierarchical taxonomy as custom post type path – URL rewrite issues
-
I have a custom post type (collections) with:
'rewrite' => array('slug' => 'collections/%collection_cat%', 'with_front' => false, 'feeds' => false)
and a custom taxonomy (collections_cat) with:
'rewrite' => array('slug' => 'collections', 'with_front' => false, 'hierarchical' => true)
I’m filtering the rewrite_rules_array with:
$rules['collections/(.+)/?$'] = 'index.php?collection_cat=$matches[1]'; $rules['collections/(.+)/(.+)/(.+)/?$'] = 'index.php?collections=$matches[3]';
On front-end
/collections/cat/
and/collections/cat/subcat/
work fine./collections/cat/subcat/postname
throws 404. Looking at $query, thepostname
isn’t recognized separately as the third match for the rewrite rule. So instead of?collections=postname
,?collection_cat=cat/subcat/postname
is queried.What is going on?
I’ll appreciate any help I can get.
Thanks
- The topic ‘Hierarchical taxonomy as custom post type path – URL rewrite issues’ is closed to new replies.