WordPress.org

Support

Support » How-To and Troubleshooting » Exclude parent category from “the_category”

Exclude parent category from “the_category”

  • I am NOT asking how to exclude a category from a page. This is on the post level.

    See, I’m using WordPress almost like a CMS and my journal is one section of the site. This whole section is a single category with entries “filed” under subcategories. When I show a journal entry, I want to list the categories it is filed under, WITHOUT listing the parent (journal) category.

    I doubt that I can actually exclude a single category from “the_category”, so I was wondering if there is another way to display them all that would give me enough control to exclude a category.

    I was thinking about using “get_the_category” to do something similar to the “Show the First Category Name Only” example given in the Codex, but inverted. The first category is the one I want excluded (it’s the parent so it’s always first) and I want the rest to be shown. But I don’t know PHP nearly as well as I understand WordPress so the whole “$cat = $cat[0];” is impossible to edit for me.

    Can anyone help me?

  • The topic ‘Exclude parent category from “the_category”’ is closed to new replies.