Creating complex URLs has never a been a great strength of WordPress.
For example, for a long time, it was recommend that you shouldn’t include categories in your URLs because of performance issues.
However, the WordPress team have been making improvements on this, and now it’s possible to include not just one, but multiple categories inside a URL. In this tutorial, we’ll show you how to make that happen.
Step 1. Organize your categories
- Go to Posts > Categories
- Set up your categories so that they are organized in a hierarchy like in the image below. You do this using the “Parent” option for each category.
Step 2. Permalink structure
- Go to Settings > Permalinks.
- Add the category to your Permalinks. You can do that by using this set up: /%category%/%postname%/
Step 3. Add only one category
- Go go to a post and look for the Categories block.
- Choose one and only one category. The reason, WordPress will stop creating the URL as soon as it finds a category in the hierarchy hierarchy.
For example, choose category 3 …
And you get this URL with all of the categories, including 3:
However, if you choose both 2 and 3 …
Then WordPress stops creating the URL after 2: