Categories’ hierarchy in URL

The posts in the website I’m currently working on have multiple hierarchical categories applied to each of them. For instance:

Source
- Books
-- Moby Dick
-- Sherlock Holmes

The permalinks are set as /%category%/%postname%/. However, the URL of a post does not include all subcategories – all I get is site.com/source/books/*postname*, even though the post in question has NOT been categories in Source, but only in Books + Moby Dick.

Could anyone help me figure out how to adjust this behaviour?

Thank you.

2 Answers
2

The permastruct /%category%/%postname%/ will include the categories and subcategories in the URL from top to first assigned child. So, if you want the URL be site.com/source/books/moby-dick/*postname*, you have to assign the post only to “Moby Dick”. Assigning the post only to “Moby Dick” category will still show the post under “source” and “books” category archives by default.

Leave a Comment