WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 want to get the list of categories of a post inside the loop. Normally, I would use

the_category(', ');

But this does output a link, and I only want the category name. Any ideas?

share|improve this question
up vote 1 down vote accepted

Should be easy enough i think..

foreach((get_the_category()) as $category) { 
    //this would print cat names.. You can arrange in list or whatever you want..
    echo '<span>'.$category->cat_name .'</span>';

Hope This Helps ;)

share|improve this answer

Without a loop

share|improve this answer
He asks for a list without links, this outputs links as well. – Florian Apr 16 '15 at 8:58

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.