How to Add Categories and Subcategories to WordPress

WordPress comes with the ability to sort your content into categories, tags, and taxonomies. One of the major difference between categories and tags is that categories can have subcategories or child categories. In this article, we will show you how to add categories and subcategories in WordPress and how to get the most SEO benefit out of categories.

Understanding Parent, Child, and Sibling Categories in WordPress

Categories are a powerful tool and can be used not only to sort your content, but to also develop a proper site structure that is meaningful and semantic.
Before moving forward, we recommend you to read our guide on categories and tags. It will help you understand how categories are different than tags, why they should not be confused or mixed up, and lastly how to properly use categories. Once you have read it, come back here and we will continue.
Let’s suppose you are creating a travel website for different destinations around the world. You may want users to be able to find articles by city and by country as well.
For example, you can add United States and then post articles for New York City, Los Angeles, Chicago, etc. This is where you can utilize child categories. United States would become a parent category, and cities can become child categories.
Child and parent categories in WordPress
It is important to note that a post filed under a child category does not need to be filed under parent category. For example, if you assign a post New York City as category which is a child category of United States, then you are free to choose whether you want the post to be filed under both or just the child category.
If you choose to file a post under the child category but not under the parent category, then your post will appear only on the archive pages of child category. This particularly helpful when you want to avoid duplicate content.
Let’s suppose you have created a parent category United States and it has only one child category, New York City. Now if you file a post under both parent and child categories, then the archive pages of both categories will be completely identical.
Having said that, let’s take a look at how to add categories and child categories in WordPress.

Adding Category in WordPress

You can add a new category in WordPress when writing a post. On the post edit screen, scroll down to the categories meta box and click on Add New Category link.
Adding new category while writing a post
You can also add a new category without editing a post. Simply visit Posts » Categories page and add your new category. This method is particularly useful, if you want to create all your categories before adding content.
Directly adding a new category without editing a post

Adding Child Category in WordPress

You can edit child categories the same way you added your parent categories. On the post edit screen, scroll down to categories section and click on the Add New Category link. This will show you text field for adding new category name and a dropdown menu to select the parent category.
Adding child category from post edit screen
Similarly, you can also visit Pages » Categories page. Add the name for your child category and then select the parent category from the Parent dropdown menu.
Adding child category from categories page

SEO Benefits of Category Based Site Structure

If you are using SEO Friendly URLs, then your child category URL will look like this.
http://example.com/category/united-states/new-york-city/
This is much more meaningful and helps search engines and users understand what your page is about. You also get a chance to add keywords into your URL, Keywords help people find content on search engines.
You can get rid of the ‘category’ prefix from your category URLs by installing FV Top Level Categories plugin. Simply install the plugin and it will remove category base from URLs of your category archive pages. You will get your category archive page like this:
http://example.com/united-states/new-york-city/

Display Categories and Child Categories in WordPress Sidebar

Your WordPress theme will automatically show the categories for each post. To display all your categories on your blog’s sidebar, you need to visit Appearance » Widgets page. Drag and drop categories widget from the list of available widgets to a sidebar.
Showing child and parent categories in WordPress sidebar
In the categories widget’s settings, check the box next to ‘Show hierarchy’ option and click on the save button. Visit your site and WordPress will show your categories with child categories aligned under the parent category.
Categories and child categories in WordPress sidebar
We hope this article helped you learn how to add categories and child categories in WordPress. You may also want to take a look these most wanted category hacks and plugins for WordPress.