Title: Excluding multiple categories
Last modified: December 25, 2016

---

# Excluding multiple categories

 *  [Mitu](https://wordpress.org/support/users/mitu/)
 * (@mitu)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/)
 * Hello,
    I’ve been trying to fiddle with excluding multiple categories from showing
   up on the index page of my blog. Unfortunately, I’m having a few problems. Using
   $cat = ‘-8′; to exclude category 8 appears to work, although when I try using
   $cat = ‘-8,-9;’, it seemsto want to ignore the second category number, and still
   only exclude category 8. I’ve tried fiddling with the syntax of this by leaving
   out the comma and such, but nothing seems to work. It baffles me how using ‘$
   cat = ‘1,2,3” to only _include_ certain categories does work, but when it comes
   to _excluding_, using that same syntax just doesn’t want to work! If anyone could
   offer any enlightenment, it would be much appreciated. (By the way, I _have_ 
   tried using the [Show-one-category-on-front-page](http://wiki.wordpress.org/index.php/show-one-category-on-front-page)
   hack as well, but again, it only works for excluding one category, not multiple
   categories. 🙁

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [martin](https://wordpress.org/support/users/martin/)
 * (@martin)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43092)
 * I’m having the exact same problem and I have found no solution so far. Does any
   one know how to fix this issue?
 *  [Ryan Boren](https://wordpress.org/support/users/ryan/)
 * (@ryan)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43102)
 * From wp-blog-header.php:
    // Note: if we have a negative, we ignore all the positives.
   It must // always mean ‘everything /except/ this one’. We should be able to do//
   multiple negatives but we don’t 🙁 This would be a nice little project for an
   enterprising contributor.
 *  [davidchait](https://wordpress.org/support/users/davidchait/)
 * (@davidchait)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43118)
 * I found I needed to use the hidden-category stuff to really do what I wanted 
   to do. It’d be easy to take that another step and have it hidden-from-frontpage
   as an option.
    -d
 *  [alvinlee](https://wordpress.org/support/users/alvinlee/)
 * (@alvinlee)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43377)
 * Can’t you exclude your categories by including only the ones you want? For example
   you wanted to exclude categories 8 and 9 and your code using $cat= -8, -9 doesn’t
   work because it only sees the first negative number. Then could this solution
   work:
    $cat = 1,2,3,4,5,6,7,10,11,12 . Just a thought, since once can exclude
   by including everything else.
 *  [dshupp](https://wordpress.org/support/users/dshupp/)
 * (@dshupp)
 * [22 years ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43459)
 * I’ve found that when I use this category inclusion/exclusion at all, wordpress
   forgets about the posts per page variable. Is there a fix for this? Am I supposed
   to do something besides add $cat = “xxx”; to my index.php for this to work as
   expected?
 *  [danes75](https://wordpress.org/support/users/danes75/)
 * (@danes75)
 * [21 years, 12 months ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43484)
 * I can’t get the script to work at all. Its implemented exactly as stated in both
   the myhacks.php and the admin section of the site, but when i go to the directory
   [http://www.homocoit.us/hc](http://www.homocoit.us/hc) … nothing. still lists
   all the categories. There’s not even any error message so I can try and figure
   out what the problem is.
 *  Anonymous
 * [21 years, 9 months ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43512)
 * I notice that it forget the post per page variable to. I am having the same problem
   myself. Someone please find a fix.
 *  [TechGnome](https://wordpress.org/support/users/techgnome/)
 * (@techgnome)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43513)
 * danes – it goes in the top of index.php, not in the admin, nor in the my-hacks.
   php files. Also, are you trying to get it to hide the category link itself? Or
   posts from that category? Setting $cat (which should only be done when it isn’t
   already set) only affects the posts displayed on the main page. NOTE: You do 
   realize that you don’t have a default CSS set? I get the raw HTML in all it’s
   gorey glory with no styling what so ever.
    I used to have the same problem of
   WP forgetting the posts-per-page setting, but since I’ve moved to Mingus I haven’t
   had that problem, so I don’t know what’s up with that. Except that based on your
   source here, I see that it looks like hte 1.0.1 version of WP is running. TG
 *  [paperlion](https://wordpress.org/support/users/paperlion/)
 * (@paperlion)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43543)
 * There’s a plug-in for category exclusions and more (asides, etc.). Supposed to
   work with 1.5 too. (It’s the one by Ryan Baron – ‘Janitor Prime’? The other one
   by Kitty doesn’t work on the new revision.
 * WP links to it are down though. Found it here:
 * [http://www.coldforged.org/archives/2004/11/15/wordpress-asides-coldforged-style/](http://www.coldforged.org/archives/2004/11/15/wordpress-asides-coldforged-style/)
 * [http://flickr.com/groups_topic.gne?id=6421#comment46452](http://flickr.com/groups_topic.gne?id=6421#comment46452)

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Excluding multiple categories’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 10 participants
 * Last reply from: [paperlion](https://wordpress.org/support/users/paperlion/)
 * Last activity: [21 years, 2 months ago](https://wordpress.org/support/topic/excluding-multiple-categories-2/#post-43543)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
