1

I Would use Custom Post Type and hierarchical Taxonomies with same Slug. Fortunately I found a good solution based on post_type_link filter here from TheDeadMedic.

mysite.com/products/category1/product-name1 
mysite.com/products/category2/product-name2
mysite.com/products/category1/subcategory1/product-name1
mysite.com/products/category2/subcategory2/product-name2
...

The only problem is subcategory pages get 404.

So these URLs work:

mysite.com/products/category1/product-name1
mysite.com/products/category1/subcategory1/product-name1 

But subcategory pages don't work in hierarchical structure:

mysite.com/products/category1/subcategory1
mysite.com/products/category2/subcategory2

I can only access these subcategories without hierarchical structure. So these URLs work:

mysite.com/products/subcategory1
mysite.com/products/subcategory2

Have you got any idea how I could extend TheDeadMedic's solution to hierarchical taxonomies too.

1 Answer 1

0

Add to the taxonomy registration:

'rewrite' => array( 'hierarchical' => true )
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.