WordPress.org

Ready to get started?Download WordPress

Forums

WP_Query exclude a specific category from posts with subcategories (4 posts)

  1. hoodibaba
    Member
    Posted 4 years ago #

    I cannot figure out why the exclusion of a specific category does not work.

    The problem :

    I have posts on my site VidYouth, http://www.vidyouth.com/ with various categories and subcategories. I want to exclude the posts from featured category from repeating any other place on the site. (Right now posts are being repeated many times).

    When I do a

    $my_query = new WP_Query('cat=3,-1'.'&showposts='.$firstcount.'');

    I get the posts from category 3 and its subcategories but it DOESNOT exclude from category 1. I have no idea how to fix this.

  2. MichaelH
    Member
    Posted 4 years ago #

  3. doc4
    Member
    Posted 4 years ago #

    hoodibaba,

    Just checking here and using the example provided, if the post is included within category 3 and category 1 you may need to move to an array to make the exclusion.

  4. hoodibaba
    Member
    Posted 4 years ago #

    First of all, thank you very much for the quick response MichaelH and doc4.

    doc4,

    Any pointers on how to get this array movement setup. I am not a php guy but can wade through some code if you can point me in the right direction

    MichaelH,

    Thanks for pointing me to the plugin page, but that does not suit the need I have. I would have to create some sections which is not how my site is structed.

Topic Closed

This topic has been closed to new replies.

About this Topic