[wp-hackers] Search in multiple categories

Jeremy Clarke jer at simianuprising.com
Wed Jan 19 16:22:10 UTC 2011

Tareq, I believe what you are looking for is the category__in query
parameter. It allows you to set multiple categories and fetch all posts in
any of those categories. You can't call it with a URL but you can use it in
new WP_Query().

You can read more about it on the codex:

When you combine these types of queries with others (like a search term) the
results aren't always what you expect (often one or more parameters is
ignored), so even if you have category__in set up properly it might not
work. A lot of work went into improving this issue for 3.1, so if it doesn't
work with 3.0.x then try it out with the 3.1 betas and see if it works
there, it's late enough in the dev cycle that any new site you're building
is probably better off starting with the 3.1 beta anyway.

Jeremy Clarke
Code and Design • globalvoicesonline.org

More information about the wp-hackers mailing list