🤯 50% Off! 700+ courses, assessments, and books

WordPress Categories Explained

    Jérémy Heleine

    Organizing WordPress posts into different categories is essential if you have many posts. That way, your visitors (and you!) can easily search and sort your posts and only see what they want.

    In this article we’ll look at how we can manage WordPress categories. We’ll begin with the description of some basic things about adding, editing or deleting a category.

    Then, we’ll look at how to display a list of our categories, and how to customize this list, with the default widget that WordPress provides us.

    Managing Categories

    WordPress give us a dedicated page for managing categories, available in the menu of the administration panel. More precisely, this page is accessible from the “Posts” submenu and is named “Categories”.

    Two Ways to Add a Category

    If you access this page, you can see a form on the left, named “Add New Category”. The first field in this form, labeled “Name”, is as it suggests, is the name that will appear everywhere you display the category of a post or the list of your categories on the site. The usefulness of the other fields is not necessarily obvious.

    First, the “slug”. As it is described right below the field, this string is useful when you activate URL Rewriting to have readable URLs for your website’s pages. For example, let’s assume that you set “category” in the “Category base” permalinks settings (from the Settings -> Permalinks menu). Then, if you enter “my-life” into the slug of your new category, visitors can access the page listing all the posts in this category by using the URL http://example.com/category/my-life.

    Note that, as this string is used in a URL, some rules must be respected, but you can in practice indicate whatever you want, as WordPress will automatically clean your string to make it “URL-friendly”.

    Right after this field we find a list labeled “Parent”. This list allows you to choose one of your existing categories to be the parent of your new category. That way, you can build your own hierarchy, which is a good thing when you have several categories. For example, if you added the category “My life” and if you want to put in one category your posts about the awesome life of your goldfish, then you can create the category “My goldfish” with “My life” as a parent. It’s exactly like directories and subdirectories on your computer.

    Finally, you can enter a description of your category in the last field. Not all themes use this field, so be sure that your theme does before spending time filling this in!

    Add Category

    To finish with the addition of a category we can note that there is also another way to add a category: when you write a new post (or when you edit an existing one). In fact, when you choose the category where you put your post, you can find an “Add New Category” link that allows you to add a new category by simply indicating its name and, if necessary, its parent. The slug will then be its cleaned name, and its description will be empty. However, you can still edit this category and change it later.

    Editing a Category

    It’s always possible to edit a category, to update its information. Editing a category can be done from the same page as previously, in the “Categories” submenu of the “Posts” menu.

    You’ll see on the right of this page the list of your categories, similar to the list of your posts in the corresponding page. By clicking the name of a category you will be redirected to another page containing a form, already pre-filled with the current information. All you have to do is modify the category you want and submit the form once you’re done.

    If you only want to change the name or the slug of a category you can also choose the “Quick Edit” option appearing when your mouse is over a category.

    Quick Edit

    Deleting a Category

    Right next to the “Quick Edit” option we find the “Delete” one. If you want to delete a category, click on this link, confirm your choice, and you’re done. You can also select all the categories you want to delete and choose “Delete” in the “Bulk Actions” list. Be careful: deleting a category is not an action that can be reversed.

    Note that deleting a category won’t delete the posts using this category. If these posts use other categories, the deleted category will just disappear from their used categories list. If they don’t use any other category, then they will fall into the default category, named “uncategorized”. Note that this is the reason why this category can’t be deleted (but you can still edit it).

    A Widget to Display the Categories

    As for the Links Manager, WordPress provides us a default widget to display a list of our categories wherever we want in our theme. Let’s test it by accessing the widgets manager from the “Appearance” menu.

    Simply named “Categories”, this widget allows us to customize its display with four settings. By default, the title of this widget is set to “Categories”, but you can change it by entering the title of your choice in the “Title” field.

    The three other settings are checkboxes that allow you to customize the list of categories. Note that, whatever you choose in these options, only the categories that contain at least one post are shown (if we forget the “parent effect” explained below).

    To explain the “parent effect” we begin with the last option: “Show hierarchy”. This option is useful if you set some categories as parents of others (see the glorious example of your life and your goldfish above). As you may guess, by activating this option, WordPress will display the exact hierarchy of your categories.

    Without this option, all of your categories are displayed in one column, without any relation between them.

    No Hierarchy

    With this option activated, the hierarchy is shown, with nested lists.


    When you activate this option you must think about an effect: parents are shown, even if they do not contain any posts themselves. For example, the two screenshots above were taken with the same configuration, with the same posts and categories. The “Parent” category does not contain any post by itself, but its children do, so WordPress displays it in the list, to show the hierarchy. It is an expected effect, but it’s always a good thing to see how it works.

    The second option, labeled “Show post counts”, is relatively clear: it adds, between parenthesis, the number of posts contained in each category.

    Post Count

    Note, again, the “parent effect”: a parent category shows the sum of all of its children’s counts.

    Finally, the first option: “Display as dropdown”, which allows you to display the list of categories as a dropdown list. This option is particularly useful if you have a lot of categories. Your visitors have to open the list and select the category they want to see. Then, automatically, WordPress will redirect them to the right page.

    Note that this option is compatible with the two others: hierarchy and posts counts can still be shown in the dropdown list.

    Dropdown List

    In Conclusion

    Categories are important to help organize your website. Now that we’ve seen how to add, edit and delete a category, you have no excuse to not sort your posts!

    If knowing how to manage categories is important, as a developer, the most important part comes with the question: how to retrieve these categories? How to list them? How to display information about one particular category?

    The answer to this question can be found in using the WordPress Categories API, an API grouping some functions that can do the things we just listed. The good news is that the Categories API is the topic of our next article!