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

How do I display all of the categories that a post is in, in sentence format.

eg. cars, boats, aircraft, bicycles.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

In the loop use <?php the_category(', '); ?> or outside the loop :

$post_categories = wp_get_post_categories( $post_id );

foreach($post_categories as $c){
    $cat = get_category( $c );
    echo $cat->name . ",";
share|improve this answer
is there a spelling mistake there - you're using cats on one hand and cat on the other. cats is not used anywhere else – Steve Jul 26 '13 at 8:15
@Steve deleted that , was planning a different way :) – Tolea Bivol Jul 26 '13 at 8:20
Perfect, thank you Tolea. – Steve Jul 26 '13 at 8:21
You're welcome Bro – Tolea Bivol Jul 26 '13 at 8:23

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.