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

On a category archive page, how do I determine what category the archive page is for? I need either the id or the slug of the category.

I am not looking for get_the_category(). This will give me all categories of the posts on this page (which can be subcategories of the category that the page is for). Instead, I want the category that the archive page is for. How can I get this category?

share|improve this question
up vote 0 down vote accepted

the ID of the current category will be available in the cat query var:

share|improve this answer
Thank you, I'm using this to highlight items in my category-based navigation, and now it finally works correctly for all possible cases! Also, I just found an example that explains how to get more details about the category on codex.wordpress.org/Function_Reference/… – Ben Sep 22 '11 at 17:09

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.