How to Include Category and Subcategory in WordPress URLs

One of the best thing about the WordPress is that it handles so many things that otherwise would have taken lot of your time.

I wanted to write about various places. As you know places are hierarchical i.e. we have many countries, Each country has multiple states, each state has districts and each district has cities and towns and towns have the places to see.

I wanted to have url as below

www.example.com/country/state/district/city/blog-title-about-place-here

Step#1

Go to settings–>permalinks and use “/%category%/%postname%/” (without double quotes)

Step#2

When you write post, make sure you select only the child category

To make sure categories are in required hierarchical order go to

Posts–>Categories

If you select all categories like India, Maharashtra and Pune, it will show url with only base category, so it is important that you select only one category, the one which is needed to be displayed in url

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.