Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

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.