I am using the_category() to display categories in my posts that are also filed in child-categories. Unfortunately this also displays the parent category which i would love to hide. Is there a way to only display the child categories and not the parent category?

Thanks in advance!

  • Can you post the_category() code you use? – Jen Nov 21 '12 at 16:44
  • At the moment I am using this <?php the_category('/ '); ?> to display the categories within the post. But as I said it's also displaying the parent categories and I would like to display the child categories only. – charlenemasters Nov 21 '12 at 21:44
  • A potentially simpler solution would be to not select the parent category when you save the post. A parent category archive will include posts belonging to its children categories. – Liana Mir Nov 22 '12 at 2:12
  • @LianaMir: Thank you this helped. I thought it was going to cause problems with my custom loops, but all is fine. Thanks! – charlenemasters Nov 22 '12 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.