7

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 ); 

1 Answer 1

13

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

$laargsM = array(
    'cat'              => 7,
    'posts_per_page'   => 300,
    'orderby'          => 'title',
    'order'            => 'asc',
    'category__not_in' => array(10) 
);
1
  • thanks Michael & really good to know its uses the 'WP_Query()' parameters too...
    – v3nt
    Commented Sep 9, 2011 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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