The right way to use classes in WordPress (newbie’s information)
Does your blog need some organization? Have you been blogging for a while without even thinking twice about the different categories you created?
We’re going to teach you about WordPress categories in this post, including how to add a new category and use it properly.
What is a WordPress Category?
Categories are part of WordPress’ taxonomy system, the system that the content management system uses to classify the different types of content on your WordPress site.
In the backend, you can use categories to organize all of the content that you publish on your blog by topic. Take a look at our own blog as an example. If you hover over the blog item in our menu, you’ll see some of the categories we use here in the Blogging Assistant.
Each of these categories represents a common topic that we cover on our blog.
This is also a great example of how blog categories improve the frontend user experience. By assigning blog posts to the appropriate categories based on the topics covered, readers can find content on the site much easier.
This is because any posts you assign to categories will appear on the archive page of each individual category. Here is an example from our blog:
WordPress categories can also be used in a hierarchy by creating parent categories, child categories, and grandchildren.
WordPress Categories vs. WordPress Tags
WordPress tags are another part of the standard WordPress taxonomy system and should not be confused with categories. While categories are the main topics of your blog, tags should represent topics that you often cover but are not necessarily the focus of on your blog.
For example, we mention the Thrive Themes suite of products quite a bit on the blog. This would make Thrive Themes a fantastic day out, but a bad category as the primary (and even secondary) focus of our blog isn’t on Thrive Themes content.
How to use categories in WordPress
There are two ways to create categories in WordPress: in the Categories section of the WordPress admin area and in the WordPress editor.
Navigate to Posts → Categories. All WordPress sites start with a default category that you cannot delete. That’s because WordPress automatically assigns blog posts to this category if you don’t assign a category yourself.
Therefore, the default category name is “Uncategorized”. Fortunately, you can rename it. First, let’s look at how to decide which categories to create for your blog.
There really isn’t a rule as to the number of categories you can create. Sticking to two to five high-level categories, however, is a great way to ensure that you stay on topic as you fill out your editorial calendar related to your niche.
Take a look at the posts you’ve published or plan to publish and make a list of all the topics they cover. No matter how many topics you come up with, try to organize them all into the two to five main categories that we talked about.
Take a technology blog as an example. General topics that this blog posts content for include Android smartphones, iOS smartphones, Chromebooks, Macbooks, Windows laptops, graphics cards, other PC hardware, and more.
Rather than creating a different category for each, consider creating a smaller number of parent categories to represent the main topics into which you can group them. In our example blog, these high-level categories could be Mobile Devices, Laptops, and Desktops.
Do the same with the topics your blog covers, then decide which parent category you use the most or which seems most important. We’re going to convert the default category to this one.
Hover over the default category and click Quick Edit. Here you have to take care of two fields. The Name field controls how your category name appears in menus and the title of your category archive page. The slug controls how it appears in your website’s URLs.
Use upper / lower case for the blank field and all lower case letters for the slug. Insert hyphens – between the words in the slug, which means “mobile” instead of “mobile” or “mobile”. Click Update Category to save your changes.
Now let’s learn how to create a new category. It’s the same process. In the Name field, enter the name in upper / lower case and in the Slug field, enter the URL format. You can also add a category description.
Then click Add New Category.
To delete categories, hover over the category name and select Delete. You can select multiple categories at once and delete them at the same time by clicking the tab at the top, selecting Delete, and clicking Apply.
How to create sub-categories in WordPress
Use the same process to create child categories. This time, however, choose a parent category to assign the child to before clicking Add.
Do the same with grandchildren, but instead choose a child category as the parent.
Using WordPress Categories in the WordPress Editor
The WordPress editor has a category section in the right sidebar. All you have to do is open it up and select the category or categories that you want to assign a single post to.
In general, you should only assign one parent category to each blog post. If you want to reassign it to a different category based on the topic the post is about, use a subcategory as well. For example, our sample post “Xiaomi’s new 200MP camera sensor from Samsung” fits into the superordinate category “Mobile Devices” and the subordinate category “Android Phones”.
If your post doesn’t fit into an existing category, create a new one right away. Just click Create New Category and follow the same guidelines as before.
The slug field is missing, but WordPress will generate one for you.
If you’ve already published posts before starting this tutorial, take some time to re-categorize them post by post. Just make sure you click Refresh each time.
How to edit permalinks for WordPress categories
Warning: Ignore this section if your site is already set up. Changing your permalink structure can lead to a lot of broken links and will likely affect your website’s overall SEO performance.
In general, it’s best to choose Post Name as your blog post permalink structure. It creates a shorter, direct permalink that is better for SEO.
However, if you want to add your parent category to your permalink structure, select Custom Structure on the Permalinks Settings page. Next, clear the field and click the% category% button, followed immediately by the% postname% button.
So if I use “xiaomi-200mp-camera-sensor” as the permalink for the example blog post I used earlier and select the parent category “Mobile Devices”, it would look like this:
- Structure of the post name: mydomain.com/xiaomi-200mp-kamera-sensor
- Custom structure with category: mydomain.com/mobile-devices/xiaomi-200mp-camera-sensor
This next tip is unnecessary, but you can do it for new websites if you want.
You can also change the base phrase WordPress uses for the permalink structure of categories. By default, this is “Category”.
WordPress uses “theme” as an example. By adding “Subject” to the Category Base field, your permalink structure would look like this:
- Standard category base: mydomain.com/category/mobile-devices
- Basis of the “Topic” category: mydomain.com/topic/mobile-devices
Some WordPress SEO plugins remove this base from your permalink structure. For example, SEOpress has “Remove / category / in your permalinks” checked on the “Advanced Settings” tab by default.
You must disable this setting if you want to use a category in your permalink structure.
Over to you
We hope you found this WordPress categories tutorial useful.
What’s next? We have many more beginner-friendly tutorials that you may find useful: