• tcb

    (@tcb)


    I have posts that belong to multiple categories.
    One of these categories is excluded via:
    query_posts(“cat=-10”);

    Problem now is the post doesn’t show up in the loop as described here: http://codex.wordpress.org/Template_Tags/query_posts

    This excludes all the posts that belong only to category 3. There is a proviso however: it will exclude all the posts that belong only to category 3. If a post belongs to another category as well, it will still be picked up.

    I want to exlude this post if it’s in only one specific category, if it’s in another category at the same time, show it in the loop.

    Did this behaviour change and the docs are not up to date?

    Can someone please help me how to include this excluded post?

    cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • Eric Amundson

    (@sewmyheadon)

    Hmm . . . not sure.

    Could you do: query_posts('cat=-10,x,y,z');

    Where x,y,z specifically include the categories you want to show?

    Downside of this is that you’d have to manually include new categories as you add them, but I’m sure there’s a little php magic that could be wrought to take care of that.

    If you’re you’ve got a fixed number of categories, I’d think it would work.

    Thread Starter tcb

    (@tcb)

    thanks for the idea, unfortunately it has no effect.

    i have no time at the moment to dig into this, but wasn’t this working some time before? it’s written in the docs…

    Does somebody remember?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘query_posts(“cat=-x”) excludes posts that have multiple categories’ is closed to new replies.