
Prior to WordPress 2.1, the wp_list_cats() function has a “children” parameter to hide your subcategories. For whatever reason, wp_list_cats() was deprecated, and the “children” parameter was dropped from the new wp_list_categories() function in WP2.1 and onwards.
So how to hide the unsightly subcategories from showing up in your sidebar? You can install and use the new function in the unfold_list_categories plugin by Braydon Fuller.
Or hide it with a quick and dirty trick using CSS. Simply open your style.css file and add the following code. And poof it’s gone
.children { display:none; }
What's Next?
»» Subscribe to Feed
» Leave a Comment
Related Posts:
» Widgets Admin Hack: Displaying 1 Sidebar at a Time
» How to Show Only Parent Category in a Post
» Theme Bugfix: Artificial Intelligence
» Newer Post: How to Improve Search Function in WP [Using Plugins]
« Previous Post: Migrating Your WordPress 2.2 themes to WordPress 2.3














You rock- seriously. Entire (counter-intuitive) plugins have been written to do what you just did with a simple stroke of common sense.
Thanks for this!
Just because of the google search results…
depth=1 now works from 2.5+
From docs…
depth
(integer) This parameter controls how many levels in the hierarchy of Categories are to be included in the list of Categories. The default value is 0 (display all Categories and their children). This parameter added at Version 2.5
0 – All Categories and child Categories (Default).
-1 – All Categories displayed in flat (no indent) form (overrides hierarchical).
1 – Show only top level Categories
n – Value of n (some number) specifies the depth (or level) to descend in displaying Categories
Thought it might be of some use to someone.
Hold on, isn’t this violating google’s terms of service? Don’t hide links on your page with css, even if it is your own internal links. This could seriously impact your rankings.