Get Category ID inside Category template

$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