Excluding multiple categories (9 posts)

  1. martin
    Posted 12 years ago #

    I'm having the exact same problem and I have found no solution so far. Does any one know how to fix this issue?

  2. Ryan Boren
    WordPress Dev
    Posted 12 years ago #

    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.

  3. davidchait
    Posted 12 years ago #

    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.

  4. AlvinLee
    Posted 12 years ago #

    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.

  5. dshupp
    Posted 12 years ago #

    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?

  6. danes75
    Posted 12 years ago #

    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 ... nothing. still lists all the categories. There's not even any error message so I can try and figure out what the problem is.

  7. Anonymous
    Posted 11 years ago #

    I notice that it forget the post per page variable to. I am having the same problem myself. Someone please find a fix.

  8. TechGnome
    Posted 11 years ago #

    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.

  9. paperlion
    Posted 11 years ago #

    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:



Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.