Empty Wordpress categories don’t show up in the sidebar navigation
Wordpress May 5th, 2006I’ve been playing with Wordpress this week for a new feature for my Raleigh, NC and ran into this issue. If a category doesn’t have any posts in it, it will not show up in the sidebar navigation. Even worse, if it is a parent category Wordpress will not show the children categories even if they aren’t empty. I dug into the source code and found that the function responsible for retrieving the category list is wp_list_cats() and by default most themes pass no parameters to it. However, it is capable of accepting a large range of settings including one to fix our problem.
In your sidebar.php file replace this:
<?php wp_list_cats(); ?>
with this:
<?php
$settings = "hide_empty=0“;
wp_list_cats($settings);
?>
Now all of your categories will show up even if they don’t have any posts in them. Unfortunately clicking on those empty categories results in “Sorry, no posts matched your criteria.”. You can change this by adding a category.php and writing your own content for the scenario where the category is empty.








May 20th, 2006 at 1:18 pm
To find out how to solve that “Sorry, no posts matched your criteria” problem, visit this url:
http://wordpress.org/support/topic/33805?replies=8#post-378560
January 6th, 2007 at 9:35 am
Hi Tony. I googled here, searching an answer to the same question. A shame empty parents don’t show their children. I tried your tweak but it doesn’t seem to have had any effect. I have about 20 categories, but only four are showing now. Looking at your categories, I think you still have the same problem as well. Do you know of any other solutions to this problem?
March 19th, 2007 at 3:33 pm
Hello,
In search of this solution, made a little tweak.
If the above line is placed in the place of the original, all categories will be shown empty or not.
Enjoy!
March 19th, 2007 at 3:35 pm
Sorry, it didn’t post.
wp_list_categories(’hide_empty=0′);
This will fix it!
April 4th, 2007 at 2:36 pm
The last comment works! I was looking for a way to take out “/category/” in my url’s. I cant figure it out.