Remove uncategorized from WordPress category list

Remove uncategorized from WordPress category list

WordPress is quite common on the web. It needs no further description. If you are still finding my language alien, you can just go ahead and learn more on WordPress.

Since my article is focused on a particular topic, I preferred not to be more descriptive about WordPress.

Now, a wordpress category list is a very interesting feature. As you already know, WordPress keeps store of its posts and pages in certain synchronized manner. Category is one such component of WordPress through which it segregates its posts.

Other than WordPress category, there are other taxonomies like tags, author, date, etc. Category is a very important feature because you can actually segregate your posts into certain similar sections.

For example, your blog is about travel articles. You can use a WordPress category feature to group your articles into categories like family tours, honeymoon outings, weekend getaways, etc.

The importance and use of this feature is when a reader chooses a WordPress category from your website, he or she gets all the articles from the same genre.

The default WordPress category features

New bloggers have a very common problem with the WordPress default feature for categories. Just after the installation of WordPress, the CMS installs some demo data and this includes a demo post (called “Hello World”) and a WordPress category called “uncategorized”.

So when you display your categories in your blog theme, this unauthorized category also gets into the list; and this becomes very annoying. You can imagine how it would feel to list all your categories and get an “uncategorized” along with it.

So, I started figuring out how to get rid of this.

I wanted to list all my categories and remove this particular name from my WordPress category list display.

I came up with two methods. I’ll share both of them with you guys.

Remove-uncategorized-from-WordPress-category-list

Hiding the WordPress category “uncategorized”

The first method was from the WordPress documentation itself.

At that point of time, I never thought of modifying that particular WordPress category. Instead I started finding ways and means to not display it in my blog, where I was listing all my category names.

So, the WordPress documentation came to my rescue. The WordPress built in functions let you list categories. The function maybe passed some parameters according to which your WordPress category list that is displayed gets altered.

So, to start with, take a look at the WordPress function to list wordpress categories. Here is the documentation.

As you would notice, that this function has a parameter type called “exclude”, and the parameter accepts and integer value.

The value to be passed must be the WordPress category id. Now, you cannot achieve a category’s id directly from the admin panel of WordPress. So, there’s another function for that. This function retrieves the category’s id when the category slug is passed as parameter. So, it’s easy now. When you list the categories, just include the exclude value retrieved from the get-id function as parameter. The result would be great! You’ll be excluding the desired category.

The easier method – changing the WordPress category

I realized this several days later, that there was an easier alternative for not displaying the WordPress category “uncategorized”.     

This easy mechanism was to modify the default to something we need. We have a list of categories and we just modify the default WordPress category to one of them.

It’s super easy.

Just login to your WordPress admin dashboard and go to posts.

Next click on categories; and you’ll see the current WordPress category listed.

Hover over “uncategorized” and you’ll see the option to edit.

Now it’s simple. Edit the name and slug as per your requirement and you’re done.

The second method is obviously smarter and less time consuming. In fact, it does not require any code hassles and complicacies as well. Consider the first method as well and keep that in mind. In case you need to omit or exclude some category in your website, then the first method can come handy.

Comments are closed.