Ready to get started?Download WordPress


Doing an AND query for categories (4 posts)

  1. Cailean
    Posted 6 years ago #

    I'm trying to pull posts that belong to two categories. So if I have four categories (A, B, C, D) I want to pull only posts that are in A and B. Not to be confused with pulling all posts from A and B.

    Any help? query_posts() doesn't seem to be able to do it.

  2. MichaelH
    Posted 6 years ago #

    Does this example from the Codex article, query_posts(), work for you?


  3. webmatter
    Posted 5 years ago #

    Many thanks, just what I was looking for!

  4. piukat
    Posted 5 years ago #

    I was trying to do the same. Doesn't seem to work though. It works if I enter one category ID only. As soon as I add a second category all I get is empty space.
    I copied the exact same code, justed altered category id's.
    What am I doing wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic