In this tutorial, we will discuss on how to manage WordPress categories. In this chapter, you will learn how to properly add, edit, delete, and display categories in WordPress. Moreover, you will learn about child category and some advanced features like converting tags to categories etc.
What is a Category in WordPress?
The "Category" is one of the most used taxonomies of WordPress. The category in WordPress is used to group contents [Post, Media etc] into different sections. In case any website publishes contents on a variety of topics, they can use the WordPress categories feature to divide their website into sections.
Example: Our CertGuidance website has publications on a variety of topics, thus we divide them into categories like ITIL Foundation, WordPress Tutorial etc.
Dividing posts into categories actually improve the user experience by means of providing a better site navigation structure.
In WordPress, if you publish a post without defining any category, then the post is automatically assigned into the default category. The default category of new WordPress installation is "Uncategorized". You can change default category from the WordPress Writing Settings (Settings ⇒ Writing Screen).
[See our guide on Configuring the WordPress Writing Settings]
You also have the option to nest WordPress categories as parent and child categories, thus giving you a way to arrange posts in hierarchical order. Moreover, you can assign a single post to more than one category, which provides you a lot of flexibility to display your posts in a way you want them in menus, widgets, or directly in your WordPress theme.
What are Parent Category and Child Category?
From the above section, we learn that WordPress categories can be arranged into a hierarchical structure. This means that categories can have parent-child relationships.
Every category in WordPress can have can have child categories listed under it. Child category is usually used to list sub-topics under broader topics (Called Parent Category).
For Example, an entertainment website may have a category "Film Industry" with child categories mentioning English Film, German Film, Italian Film, Hindi Film etc.
You can add/create a Child Category from the categories screen or while writing a post. To create a child category, you have to just select a parent category while adding a new category. Shown in below image, also explained in the “How to Add Categories in WordPress” section down in this article.
How to Access the WordPress Categories Section:
To access the WordPress categories section, you have to check the Posts ⇒ Categories option from the left side admin menu. [As shown in the below image]
[See our guide on Exploring WordPress Admin Menu]
How to Add Categories in WordPress:
There are two ways you can create or add categories to your WordPress Site. The First is from the categories screen and the second option is directly from the post page.
We will now explore both of these options one, one after another.
First Method: From WordPress Categories Screen:
We already know that how to open the categories screen. In this screen you will directly get the option to create a new category. You just have to put some mandatory details for adding a new category. [As show below]
The details you have to provide are:
Name - Enter a unique name for the category you want to create.
Slug - It is the URL for your category archive. This field can only contain lower case letters, numbers, and hyphens. This is an optional field. If you don't specify anything, WordPress will generate a slug based on the category name. See our guide on Configuring WordPress Permalinks.
Parent - This is only applicable if you want to create a child category. You can select the parent category from the drop-down if you want to nest the category under some other category or you may leave it as None to create a parent category.
Description - This filed is also an optional field. Here, you can write a brief description of your category if you wish to.
After providing the information, just click on the Add New Category button to add a new category in WordPress.
Second Method: From WordPress Post Screen:
You can add/create a category in WordPress at time of writing a post. On the right side of the post editor screen, there is a "categories" meta box showing a list of existing WordPress categories. Here, you can also create a new one by clicking on the "+ Add New Category link" [Shown in below Image].
But remember that, here you will only have the option to provide a name for the category; no other options would be available here.
How to Assign Posts to Categories:
Once you have created the category structure, you can now add posts to categories. There are two ways you can add post to categories in WordPress.
The first one is to open/write a particular post and mark a checkbox in the category section [right side of editor].
See our guide on how to properly create WordPress Posts for more detailed instruction.
The second way is to go to "Posts⇒All Posts" screen. Then hover over to the post you want to assign to category and click on quick edit.
At that point, several new sections will show up, which will allow you to edit different settings of the selected posts. One of those sections would be the Categories section. Here, you can mark [checkbox] the category you want to add the post to and click on the Update button.
How to Edit or Delete WordPress Categories:
Categories can be easily edited from Posts ⇒ Categories screen. Move your mouse to the category you want to edit and this will show up a menu displaying various options [Shown in below image]. Click on "Edit" link to edit the category in the editor where you can change name, slug, change parent category, and change description.
You can also delete categories from this screen, from the same hover menu used to edit the category. Deleting any category does not delete posts filed under it. Instead, if a post is not assigned to any other categories, then WordPress would automatically assign the post to the default category.
It is also important to remember that you cannot delete a default category. If you plan to delete the current default category then you must first assign the default status to some other category.
How to Display Categories in WordPress:
Categories can be displayed in the sidebar using a widget and in the menu using the menu editor. We will now learn how both of them work.
Displaying Category in Sidebar:
Categories in WordPress can be displayed in the WordPress sidebar using categories widget. You can use the default categories widget or may install a customized category widget plugin to show the widget.
To display categories Go to Appearance ⇒ Widgets, click on the categories widget and select sidebar (alternatively you can drag & drop the widget to sidebar area). It will display the list of all your categories in the sidebar, except for categories that do not have any posts assigned to them.
You can also customize the widget to show the post count, list categories as drop down, or show categories in a hierarchy format.
Display Category in Menu:
You can also display/add categories to your website’s navigation menus. To do that, go to Appearance ⇒ Menus, click on categories, select the category you want to add, and then click on Add to Menu button.
How to Convert Categories to Tags or Vice Versa:
Categories and tags both are pre-defined taxonomies in WordPress. However, they are handled differently by WordPress. You are free to create any number of tags or categories in WordPress. Though there is no usage restriction, you can think WordPress categories as broader sections of a website while tags can be thought of as keywords.
In some scenarios, you may wish to change your categories into tags or tags into categories. To do that, go to Tools ⇒ Import and install the Categories and Tags Converter (if not installed). Then click on Run Importer, which will lead you to another window showing you the option to convert categories to tags or tags to categories. [Shown in below image]
Select the appropriate option and press the convert button. That’s all; WordPress will convert the same for you.
We hope that you have enjoyed the above article describing WordPress Categories. Be with us to explore free training on Leading Technologies and Certifications.
Leave us some comments if you have any question or doubt about the usage of categories in WordPress, we will be happy to help you.