Categories are the easy way to classify posts of same group and help users to read or subscribe to only that part instead of the whole site content which may not be completely relevant to them. Since WordPress was initially built as a blogging platform before it evolved as a full scale content management system it offers easy way to create and manage categories for your blog posts. Note that categories can only be used for posts and pages can only be organized by assigning to a parent page.
Defining Your Site Structure
Since categories define the structure of your site, it is necessary to create them before you create a blog post. Blog posts can be assigned to one or many categories within a post editor. Before you start, write down all the category of your site and make a tree structure something like the below example.
This will help you in writing articles focusing the scope of the site as well as assign the articles easily to the related categories.
Creating Categories in WordPress
Login to your admin dashboard and navigate to “Posts > Categories” section. Enter the following details to create a category in WordPress:
- Name – give any meaningful name to your category, which can be easily understood by the users.
- Slug – this is the user friendly URL of your category name. For example, if you enter a slug as “Google” then your category URL will be http://yourssitename.com/category/google/.
- Parent – use parent attribute to define the structure for your category.
- Description – Enter a description which will be showing in search engines when the category URL is displayed.
Click on the “Add New Category” button to create a new category for your site.
Note: The word “category” can be striped of from the post URLs by using permalinks. The word “category” can be striped of from category URL by using any plugins like “Yoast SEO”.
Assigning Categories to Blog Post
Once you defined the entire structure of categories then navigate to “Posts > Add New” for creating a blog post. Category widget is placed in the sidebar which can be enabled or disabled under screen options.
Assign required categories to post by selecting the check boxes and publish your content. You can also create a category within post editor and assign it to the post. Adding a post to sub-category will automatically add the post to parent category as well, even if you have not selected the parent category check box.
You can also move the category widget below the post content in the editor by choosing number of columns as one under screen options.
Bulk Assigning Categories to Posts
If you want to assign or remove categories to many posts then navigate to “Posts > All Posts” and choose an “Edit” bulk action.
Here you can assign or remove categories in bulk.
Displaying Categories in Published Site
Now that you know how to create and assign categories to a blog post, the next step is to display the categories in your published site’s sidebar. Navigate to “Appearance > Widgets” section and drag and drop “Categories” widget to the widget area.
You have a few options to display it as drop down, show post counts and show in hierarchy.
Points to Remember
- When you install WordPress, there will be a default category with the name “uncategorized”. Ensure to change the name of this category as per your need.
- There should be at least one category exist in a WordPress site, hence you can’t delete all categories at the any point of time.
- There should also be a default category which will be used when a post is not assigned to any categories. This means you can’t create a post in WordPress without assigning a category to it.