Every time you post something on your WordPress site, you must choose atleast one category. They are very important for a site structure and also this is great for your WordPress SEO. Subcategories are used for further organization of your content.
How to Add Categories in WordPress
First, log-in to your admin panel, and click on Pages -> Categories on your left sidebar. This is very useful if you want to add all your categories before adding a post. In this way you can edit the slug or URL of your categories. Here you can edit, rename and delete your categories.
How to add a subcategory (child category) in WordPress?
You can add subcategories in the same way you have added your categories. The only difference is that you have to choose parent category from the dropdown menu.
Your child categories can also have their child categories in the same way.
After you create the categories on your website, most probably they will look like this:
The link like this helps the search engines and the visitors to understand what your page is about.
You can also easily change the /category/ prefix on your category URLs in WordPress. You can even get rid of it entirely if you like.
Simply go to the Settings -> Permalinks page and scroll down to the section titled “Category base”.
Here you can enter the prefix you want to use and save your changes by clicking the Save Changes button.
How to Display Categories and Child Categories in WordPress Sidebar
To display a list of categories, add a widget to your WordPress sidebar or footer. Go to Appearance -> Widgets in your WordPress dashboard.
If you haven’t changed your widgets from what WordPress installs by default, the Categories widget should already be there. If not, you can drag and drop it from the left-hand side’s list of Available Widgets.
By default, the widget displays all of your categories in alphabetical order in a flat list.
If you like, you can make it so that the child categories (subcategories) appear beneath their parent categories. To do so, simply check the ‘Show hierarchy’ box in the widget. Don’t forget to save your job by clicking the Save button.
Your parent categories should now be visible on your site, with the child categories nested beneath them.