WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to exclude a category from my categories sidebar widget. If I understand the way this works, the sidebar.php code is not in use since the widget is displaying the categories. (something similar was discussed in this support topic: http://wordpress.org/support/topic/problem-trying-to-hide-a-category-in-the-sidebar ).

How can I modify the query used by the widget; or is there another means of excluding specific categories from inclusion in the category list?

share|improve this question

This may help...


share|improve this answer
The article was helpful in finding the information. – Robert Altman Jul 27 '11 at 15:38
up vote 0 down vote accepted

I'll answer my own question so that the results are in the discussion thread.

All of the suggestions I've seen don't seem to work with the current version of WordPress (3.2). There are some widgets which will execute PHP script directly, used in conjunction with the correct query, this qualifies as a solution.

Plugins with PHP capability:

I used PHP Code Widget myself.

The query:

<?php wp_list_categories('show_count=1&exclude=12,24&title_li='); ?>

(or similar).

You still need to lookup the value of the category or categories to exclude; in this case, I excluded categories 12 and 24

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.