WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
Can you post the_category() code you use? – guiniveretoo 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 posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.