Same slug on custom post type and hierarchical taxonomy
-
Hello,
I have a Custom Post Type and a Hierarchical Taxonomy.
[CSS moderated as per the Forum Rules. Please just post a link to your site.]
With a post_type_link filter I can achieve the following URL structures:
mysite.com/eskuvoi-ruhaszalon/category1/product-name1
mysite.com/eskuvoi-ruhaszalon/category1/subcategory1/product-name1function filter_post_type_link($link, $post) { if ($post->post_type != 'wedding_salon') return $link; if ($cats = get_the_terms($post->ID, 'salon_location')) $link = str_replace('%salon_location%', array_pop($cats)->slug, $link); return $link; } add_filter('post_type_link', 'filter_post_type_link', 10, 2);
But taxonomy subcategory pages return with 404 error. I can only access subcategories without hierarchical structure.
mysite.com/eskuvoi-ruhaszalon/category1/subcategory1 – doesn’t work 404
mysite.com/eskuvoi-ruhaszalon/subcategory1 – it worksDo you have any idea how can I fix hierarchical taxonomy URL structure in this case?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Same slug on custom post type and hierarchical taxonomy’ is closed to new replies.