Custom post query for multiple categories + single tag (2 posts)

  1. zenwebb
    Posted 3 years ago #

    I'd like to query for all posts that have a certain tag, but limit the results to only show posts that are within certain categories. In other words, I have a portfolio page that contains posts from multiple categories, all tagged "Portfolio". I want to have sections on my portfolio for specific topics, like Coding, Art+Design, etc, which can span multiple categories.

    Semantically, I'm trying to query for posts that match something like this: ((category1 OR category2 OR category3) AND tag1)

    Can someone help me construct the proper query for this? I've tried combining parameters in the query_posts() function, but it didn't work. Can someone help me construct a more advanced query for this?

  2. vtxyzzy
    Posted 3 years ago #

    I think you can use a query like this:


    where 5, 6, and 8 are the category ids and tag1 is the tag slug.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.