WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm doing a category-based search that looks like this:

$feed = WP_Query("category_name=noticias&showposts=3&order=DESC"); 

The problem is this also brings me posts from the child categories, which I would like to avoid... how do I do this?

If I do something like

$feed = query_posts(array('category__in' => array(102)));

Then I am told that $feed is not an object next time I try to do something with it... that's why WP_Query was good for me in the first place.

share|improve this question
up vote 0 down vote accepted

you can use the 'category__in' in WP_Query; example:

$feed = WP_Query(array('category__in' => array(102), 'posts_per_page' => 3, 'order' => 'DESC'));  
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.