Forums

excluding multple categories (3 posts)

  1. JaneLitte
    Member
    Posted 5 years ago #

    I've searched but can't seem to find a definitive answer. Can I exclude multiple categories using query_post?

    <?php
    if (is_home()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=-26&cat=-36&paged=$paged");
    }
    ?>

    I read at another website that if I put the excluded categories into a parent category, I can exclude the parent and the children with one variable, but I would prefer not to do that.

  2. drmike
    Member
    Posted 5 years ago #

    User:JamesVL/query_posts

    Looks like the issue maybe that if the post in question is included within another category, the post will be included.

  3. JaneLitte
    Member
    Posted 5 years ago #

    drmike - I've looked at the link and that addresses only the exclusion of one category.

    I know that I could do it conversely - i.e., list all the categories to be <i>included</i> but it's easier to exclude 2 categories than include 20.

    Are you saying, though,a s long as the post is marked with just one category, that the multiple category exclusion should work?

Topic Closed

This topic has been closed to new replies.

About this Topic