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?

1 Answer 1


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

  • 1
    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, 2011 at 17:09

Your Answer

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

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