How to only use top category in permalinks
-
Hi,
I would like to only use the top level category in the permalinks of my posts.For example, lets say I have this category structure:
-Recipes
–Appetizer
–Main dish
–Lunch
–Soup
–Dessert
–Vegetarian
–Etc…Now let’s say I create a post for “Garden vegetable soup recipe”, I would tag this post with the 3 following categories “appetizer” , “soup” and “vegetarian”.
If I set my permalink structure to /%category%/%postname%/ this result in a url like :
https://domain.com/recipes/appetizer/garden-vegetable-soupThis is not what I would want, instead I would like :
https://domain.com/recipes/garden-vegetable-soupI do not want to have any sub-categories in the url (most posts are associated with multiple sub-categories).
I tried the plugin Single category permalink but it didnt work for me, not sure why… ( tried to add the top level category to each post, but the urls kept including the subcategory even after I reset the permalink structure in wordpress)
NOTE: you might wonder why I have the “recipes” top level category at all if I do not tag any post with it, this is because I also have other top level categories for other topics, similarly for those other topics, I want their own respective top level categories to be the only category appearing in the permalinks…
Thanks,
- The topic ‘How to only use top category in permalinks’ is closed to new replies.