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

Fix the ‘Scheduled Maintenance’ Error on WordPress

One of the most annoying error in WordPress is the ‘Scheduled Maintenance’ message a Webmaster gets after an automatic upgrade has completed. This problem is mainly caused by a failed automatic upgrade or an interrupted update process.  So each time a visitor tries to visit your home page, he/she will get the following message: Briefly unavailable […]

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 […]

WordPress Hack: remove “WordPress Generator”

The publishing platform WordPress adds a small line for itself to advertise and clarify that the site that you find is a site using WordPress. Except that in addition to reporting that it’s WordPress, it goes to show the current version.It is not embarrassing, except that each version has its security problems… Past one of […]

5 WordPress Plugins To better monetize your blog

When we talk about Monetizing a Blog, many people think about Google Adsense as the only solution, but this is not true. So here is a list of 5 plugins that will help you change this idea. Adserver Adserver is an ad server for wordpress. You can set up your campaigns with banners of different […]