Get Category ID inside Category template

how do I get the cat ID inside the Template. Very important:
I can not do it by the name, because we have muliple cats with the same name. Only the slug is different. If I’d get the slug, it would be okay, too.
But like I said: I can not use the Cat title…..

9

$wp_query->get_queried_object() will give you the “currently queried object”. On a category archive this is the category object, on a author page this is the author, on a single post this is the post itself, … well, you get the the idea. If you only want the ID you can also use $wp_query->get_queried_object_id().

Leave a Comment