3 Best Ways To Customize Your WordPress Categories

How many WordPress categories and subcategories do you have? I am sure, your answer will be lots of. You have cre

ated lots of categories and subcategories to properly organized your blog posts. Right?

But, have you ever wonder, how these categories will look like when added to the WordPress sidebar? Just check out the below-attached snapshot for more information.

Categories in WordPress Sidebar
Categories in WordPress Sidebar

A long list of categories (including sub or child categories) will appear on your sidebar. The size of this list will be based on a number of categories you have. Trust me, it doesn’t look good when you have lots of categories on your blog. Instead, it is better to show only a few selected or main categories on your blog.

But, unfortunately, in WordPress, by default there is no such option to disable or exclude subcategories from the list.

WordPress Exclude Category From Widget

The only option available is ‘to show your categories in a drop-down menu’. But, in this option, your list will get replaced by the simple drop-down option which includes categories and sub-categories in it. The below-attached snapshot will clarify everything.

Drop Down Categories in WordPress Sidebar
Drop Down Categories in WordPress Sidebar

Now, a question may arise? How to

  • hide specific categories from the Category Widget?
  • exclude categories from WordPress Sidebar?
  • exclude sub or child categories from the Category Widget?
  • show only parent categories in WordPress Sidebar? and
  • show only top level categories in the Category Widget?

If you are looking for the same answers then this post will help you. In this post, we will share the 3 best ways to show categories on your WordPress post. Using these options, you can easily display categories as per your needs or requirements.

Just check out our blog LoveUMarketing, how we are displaying only four selected parent categories on our blog.

how to show specific categories in wordpress sidebar
how to show specific categories in WordPress sidebar

So, What are we waiting for? Let’s start with these tips below.

Using WordPress Plugin On Your Blog

There are many WordPress plugins available online to exclude or include specific categories or subcategories. You can use any of these plugin to customize your category list.

But, please make sure you checked the detail instruction (including features) before installing any plugin on your blog.

Actually, a single plugin can’t help you to hide, exclude, specific, filter and remove parent or child categories. Different plugin support different functions or features. For example, If one plugin will allow you to hide any specific categories then the second plugin may allow you to select specific categories.

Next, at the same time, it is also important to check whether the given plugin support sub or child categories or not? This is because, some plugins are actually designed for parent category only.

Next, different plugin may have different setting available. Hence, it is always advisable to check plugin page thoroughly before installing it.

Hide WordPress Categories Using Code in Function.Php File of WordPress Blog

The second way to customize your category list is through using custom code in function.php file. You can use the below code to exclude any category from the list.

// Exclude or Hide your categories from WordPress blog widget
function exclude_widget_categories($args){
$exclude = “5”;
$args[“exclude”] = $exclude;
return $args;
}
add_filter(“widget_categories_args”,”exclude_widget_categories”);

All you need to do is simply copy and paste the above code in function.php file. Next, replace the ‘5’ with your category id.

Next, replace the number ‘5’ with your category or subcategory number you wants to exclude. To know, how to get the category number, please refer the below attached snapshot.

In case of more than one categories, you can mentioned all of them using comma. For example ‘5,6,23’. But, make sure, all the categories are covered by the comma at both end.

How to find the Category Id in the WordPress Blog
How to find the Category Id in the WordPress Blog

Note: The above mentioned code will exclude specific categories from theĀ  WordPress Widget.

Exclude WordPress Categories Using WordPress Menus In The Sidebar

The next best way to customize your category list is using WordPress Menus. In this technique, all you need to do is

  1. Create new menu
  2. Add your specific categories to newly created menu
  3. Add your menu to the sidebar.

That’s it. Now, your menu (consisting of selected categories) will appear on the sidebar.

Note: We are using this method to show only parent categories on our blog.

Use WordPress Menu To Customize Category List
Use WordPress Menu To Customize Category List

Next, we strongly recommended using this method on your blog. This is because

  • It does not involve any kind of editing code in your file.
  • It does not involve installing any kind of plugin on your server
  • Within few clicks, you can easily include or exclude any category from the list.
  • WordPress menu is a default feature, already available on your blog.

Hence, the WordPress menu is the best way to exclude or include any category from the list.

Wrapping Up

Above all are the three ways to exclude, remove, hide, specified parent or child category from the list. Using any of these method, you can easily customize your category list.

Lastly, feel free to contact us if you face any problem in understanding any of the above mentioned techniques. We will be happy to help you.

Next, if you know any other way to exclude or include specific category then please do share with us. You can share your message in below comment box or contact us directly through contact us page. We will be more happy to consider your suggestions in our list.

Click on a smiley to rate it!

Average rating / 5. Vote count:

If you like this post, please share with your friends. Sharing is Caring.

Leave a Reply

Your email address will not be published. Required fields are marked *

sixteen + 11 =