This can be a bit challenging for WordPress, because it wouldn’t know whether you are referring to post, page or taxonomy. Nevertheless, rename your taxonomy to something like product_category
and try changing the slug in your post type arguments to system/%product_category%
, and slug in your taxonomy arguments to just system
. WordPress should now handle /system/your-product-category/post-name/
Out of the box WordPress doesn’t recognize the permalink structure tag %product_category%, so we need to declare it:
function filter_post_type_permalink($link, $post)
{
if ($post->post_type != 'system')
return $link;
if ($cats = get_the_terms($post->ID, 'product_category'))
$link = str_replace('%product_category%', array_pop($cats)->slug, $link);
return $link;
}
add_filter('post_type_link', 'filter_post_type_permalink', 10, 2);
NOTES:
- This will just grab the first product category for the post ordered
by name. - There still may be some 404 errors, if pages, posts etc., have same names.