Every time you add a new theme to your WordPress blog and you find that this theme show all your categories in a menu. The idea of excluding a category from the menu come directly to your mind.

Today I propose to change the categories menu you have in your home page to suit your needs.

exclude-a-category-from-your-wordpress-index

Initially if you do not have this menu, and you still have the classic menu which include: Home, About, etc. …

all you have to do is using this small code in the place you think you want to show the menu in :

[sourcecode language=”php”]
<?php

wp_list_categories(‘orderby=name&title_li=0’)

?>[/sourcecode]

Now if you want to exclude a specific category add this ” &exclude=10” to your code to have something like that :

[sourcecode language=”php”]
<?php

wp_list_categories(‘orderby=name&title_li=0&exclude=10’)

?>[/sourcecode]

Where 10 is the category ID

If by any chance you want to exclude more than one category, you simply just add a comma after the number of the first category then enter the following number.

[sourcecode language=”php”]
<?php

wp_list_categories(‘orderby=name&title_li=0&exclude=10,33,454’)

?>[/sourcecode]

You May Also Like

Save more WordPress’ database disk space with a simple trick

If you use WordPress as blogging platform, and you have installed a recent version, you must have see that it has become more greedy in space. This is particularly due to the registration of “revisions”. What is “revisions”? These are versions of posts that are recorded as you write. This is a very useful feature […]

What’s New In WordPress 4.3

  WordPress is the most widely used content management system in the world. It is an excellent platform for beginners to launch their blog without needing expert knowledge on HTML. WordPress is also useful for sole proprietors who want their business to have an online presence but at the same time do not want to […]

Pressable: The WordPress Hosting Built for Next-Generation Demands

WordPress isn’t your grandfather’s blogging platform anymore. Pressable understands this fundamental shift. While most hosting companies are still optimizing for traditional page rendering, Pressable by Automattic, the team behind WordPress itself, to handle what comes next. Multi-channel content. Headless architectures. API-first patterns. Infrastructure that evolves with the platform, not behind it. The disconnect between what […]

Backing Up WordPress – Be Secure

Every user of WordPress knows that there is always a need to back up their files and database. This is because the security level of the WordPress is not be strong enough and that your site might get hacked. If your site will get hacked, surely your files and databases will be gone. So as […]