No Sub Category Posts in Loop

By michael  |  January 29th, 2009  |  Published in WordPress Plugins  |  23 Comments

This WordPress plugin will remove posts from your loop that belong to sub categories.

By default, if you are looking at “Category A” archive, you’ll see all posts from “Category A” as well as all posts from any sub-categories of “Category A”. Once activated, this plugin will only display posts from the current category.

There are currently no options. If you think of any and that could be used by many, I’ll add them to it. For now, just install and activate.

File: Hosted at


  1. baron says:

    January 30th, 2009 at 8:02 am (#)

    hi. Thanks for plugin



  2. WordPress Plugin Releases for 01/31 says:

    January 31st, 2009 at 5:26 pm (#)

    […] No Sub-Category Posts in Loops […]

  3. WordPress Plugin Releases for 01/31 | Web 3.0 says:

    January 31st, 2009 at 5:27 pm (#)

    […] No Sub-Category Posts in Loops […]

  4. WordPress Plugin Releases for 01/31 | Tips Wordpress says:

    January 31st, 2009 at 5:33 pm (#)

    […] No Sub-Category Posts in Loops […]

  5. WordPress Plugin Releases for 01/31 | Wordpress Blog NL says:

    January 31st, 2009 at 5:54 pm (#)

    […] No Sub-Category Posts in Loops […]

  6. MchaelH says:

    February 9th, 2009 at 2:16 pm (#)

    See problem report.

  7. Glenn says:

    February 9th, 2009 at 3:42 pm (#)

    This has been corrected with version 0.3. Thanks!

  8. Miguel says:

    February 26th, 2009 at 12:03 am (#)

    hey, this plugin is veryy useful!!
    but, i have a suggestion :] so the plugin cuts out the subcategories posts from the main category, right?

    the thing is im doing this music blog, so i have the # A B C D… as main categories, and the singers name as subcategory, like Jason Mraz would be a subcategory of J.

    so, i wanted that ppl could go to the J category, see the subcategories links there, than at the subcategory page their posts. 😛

    Well, your plugin started my work by cutting out the subcategories posts from the main, but the thing is, when ppl go to the J category now, they see a Not Found page, =(…

    Its kinda of hard to explain myself because im not american 😛 so im just givin you this opnion because i dont think no one ever done a plugin like that 😛 and it would probably give your plugin more fame and stuff….

    well, hope i helped =p dont know if its possible, but i tried =]


  9. Gordon says:

    February 26th, 2009 at 6:34 pm (#)

    Hi thanks for this great Plugin. I use WordPress 2.7.1. and the Plugin diden’t work. I don’t know why. Could you help me?

  10. Ben says:

    March 19th, 2009 at 9:43 am (#)

    great plugin

    can this be omitted (turned off) for certain pages, eg home page

  11. Christian Kopp says:

    April 2nd, 2009 at 1:47 pm (#)


    on my Website, I use sub categories which have only private post assigned to. Unfortunatly, the parent category still shows the private posts of this sub category.

    I have fixed this issue by change lines 53-54 of your plugin:

    // Get children categories of current cat if they exist

    if ( $excludes = get_categories("hide_empty=0child_of=".$wp_query->get('cat')) ){


  12. Die Hit-Liste: WordPress das Magazin und mehr says:

    April 4th, 2009 at 4:38 am (#)

    […] dieser Kategorie sichtbar sind – WP zeigt ja alle Artikel aus Subkategorien auch an. Das macht No Sub Category [FullThrottle Development] Hauptentwickler des Plugins ist Glenn […]

  13. Glenn says:

    May 21st, 2009 at 10:37 am (#)

    Thanks for the feedback everyone. I’ve been pretty busy lately but look for an update towards the end of June.

  14. Doug says:

    June 28th, 2009 at 9:11 am (#)

    I am trying to make a site on my domain that will have 3-4 different blogs.

    I created a page for each and was hoping to stream my various posts into ONE of the four blogs based upon the catagory I origionally placed upon the post.

    I downloaded and installed your plug-in, but am not certain that it is the solution to this problem.

    Please advise! Thanks!

  15. Sue says:

    July 20th, 2009 at 5:20 pm (#)

    Thank You!!!!

  16. kruno says:

    October 23rd, 2009 at 2:01 pm (#)


  17. Yves says:

    March 12th, 2011 at 3:19 pm (#)

    Plugin has errors in 3.1
    will you fix it?

  18. Jeff says:

    March 14th, 2011 at 4:35 pm (#)

    update to .4 is not working for me running wp 3.1… see /?category_name=ministries… it is still querying subcats… any suggestions?

  19. Al says:

    July 12th, 2011 at 12:26 pm (#)

    Great plugin and works fine for me, except when the category name contains spaces, as in “Costa Rica”
    All other categories work fine.
    Any ideas?

  20. LFVoy says:

    October 18th, 2011 at 10:12 pm (#)

    This does not work with WP 3.2.1.

  21. Ivovic says:

    January 30th, 2012 at 4:18 am (#)

    Has this been tested with wp 3.3.1?
    It suddenly stopped working for me, but I can’t remember if it was before or after I upgraded :(

  22. Mark says:

    March 18th, 2012 at 3:42 pm (#)

    thanks for the plugin, but I wonder if this could be adapted to the Category level pages (I think that is what they are called) and not just the Archive pages?

    I am using the directorypress theme, which calls posts “listings” and it shows “listings” for the current category AND for the subcategories (according to the developer of directorypress, their “listings” are the equivilant of standard wordpress posts).

    I want it to show just the listings (i.e., just the posts) of the current level category.

    Is that possible?

    Thanks in advance.

  23. Amit says:

    August 4th, 2013 at 8:42 am (#)

    not working in 3.5