How to create a permalink for custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name

When you create permalink structures like /article/%category%/%postname%/, it becomes very complicated when %category% is hierarchical. The problem WordPress runs into is knowing if after the second slash, the next part of the URL is a category or a post. For instance, in the url /article/parent/child/, is “child” a subcategory of “parent”, or is it a post named “child”? In your case, it’s even worse because your articles are also hierarchical.

Your best bet is to add a predictable or static separator between the two. Here are some examples:

/%article_category%/articles/%article%/
/articles/%article_category%/article/%article%/
/articles/%article_category%/%year%/%article%/

If you insist on maintaining the structure you propose, it’s not impossible, but it would require some custom programming far beyond the scope of a Q & A site like this one.

Leave a Comment