When displaying a category how can I tell what category it is? Say I'm on http://www.example.com/category/quotes, how can I get quotes aside from parsing the URL? I tried get_the_category() but it returns an array of all the categories of the first post shown in the page.

2 Answers 2


This should get you category object with ID, slug and rest of info:


You can get the category name with:


Reference: http://codex.wordpress.org/Function_Reference/single_cat_title

  • thanks for pointing me to that function, unfortunately I can only accept one answer and I picked Rarst's as I can make good use of the extra info returned by that method Nov 3, 2010 at 7:49
  • No problem! You are welcome.
    – sorich87
    Nov 3, 2010 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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