WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Exclude category from array (5 posts)

  1. canutedechou
    Member
    Posted 3 years ago #

    i ussually have no problems wit excludng categories with the normal method, but i just cant figure out because these query is different from the one i usually use

    i need to exclude a id category from these query
    i have

    here is the paste bin

    any idea?

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    $catid = 127; //the cat id to exclude
    $args = array( 'posts_per_page' => 5, 'category__not_in' => array($catid) );
  3. canutedechou
    Member
    Posted 3 years ago #

    genious!
    thanks a lot!

  4. canutedechou
    Member
    Posted 3 years ago #

    and (got another question)
    how do i exlucde 2 categories?

  5. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

    example:
    'category__not_in' => array(127, 233)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.