Support » Fixing WordPress » WP_Query exclude a specific category from posts with subcategories

  • hoodibaba


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

    The problem :

    I have posts on my site VidYouth, 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • MichaelH





    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.



    First of all, thank you very much for the quick response MichaelH and 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


    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP_Query exclude a specific category from posts with subcategories’ is closed to new replies.