WordPress.org

Ready to get started?Download WordPress

Forums

Child category posts showing in parent category page? (5 posts)

  1. vavroom
    Member
    Posted 6 years ago #

    Hello all,

    I've spent some time on the forum and codex and Google, but I can't seen to find the answer to my question.

    I have a problem with posts in a child category showing up in the loop in the parent category page, even if the post is only assigned to the child category. How do I stop that from happening?

    For example, if my post "red roses" is in the child category "roses", it shows up when I call the parent category "flowers", even if I only associate the post to the child category "roses".

    What's the best way around that?

    Thank you for any and all information

  2. vavroom
    Member
    Posted 6 years ago #

    Anyone?

  3. Innate
    Member
    Posted 5 years ago #

    I wish someone could answer these forums... this particular issue especially!!!
    my eg: new WP_Query('cat=5&exclude=16,17,13,12,14,15&showposts=1'); - this still displays the latest post from this category AND ITS CHILDREN and they are excluded!!
    Any answers anyone??

  4. iridiax
    Member
    Posted 5 years ago #

    You could use query_posts for the parent categories and conditional tags or custom category templates (like category-42.php for the category with ID of 42).

  5. poolboy
    Member
    Posted 5 years ago #

    I found the answer on this website for anyone interested.

    http://lonewolf-online.net/computers/wordpress/prevent-showing-subcategory-posts/

    Hope it helps.

Topic Closed

This topic has been closed to new replies.

About this Topic