WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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

getting posts by cat with get_posts but need to exclude another cat called london or id 10. is this possible?

best, Dc.

//  array(7,-10)
    $laargsM = array('category' => 7, 'posts_per_page'=>300, 'orderby'=>'title', 'order'=>'asc' );
    $la_shapes = get_posts( $laargsM ); 
share|improve this question
up vote 0 down vote accepted

as 'get_posts()' uses the 'WP_Query()' parameters, i would assume that this should work:

$laargsM = array('category' => 7, 'posts_per_page'=>300, 'orderby'=>'title', 'order'=>'asc', 'category__not_in' => array(10) );
share|improve this answer
thanks Michael & really good to know its uses the 'WP_Query()' parameters too... – daniel Crabbe Sep 9 '11 at 12:12

Your Answer


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.