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

Let's say I got the following categories:

  + Shoes
  + Pants

If I make a post and put it in the Style and Shoes category, it will list them alphabetically instead of hierarchically. So it would list it as Shoes, Style instead of Styles, Shoes.

How can I do this? I tried using "the_category('> ', 'multiple')" but that outputs "Style, Shoes, Style"


share|improve this question

1 Answer 1

up vote 1 down vote accepted

You could fetch the post categories, then pass them into wp_list_categories to take care of displaying them hierarchally.

Something like..

wp_list_categories( array( 
    'include' => array_keys( get_the_terms( $post->ID, 'category' ) ), 
    'title_li' => '' 
) );

Hope that helps.. :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.