I want to get the current category details that the user is on in category.php.
$category = get_the_category();
$slug = $category[0]->slug; // Why is this an array ?
In most cases (where there are no sub-categories) it returns and array of single length.
But if there are sub-categories it (parent category and ) returns an array of 2 or more.
http://domain.com/category/cat-name/ -> get_the_category() returns an array of 2
http://domain.com/category/cat-name/sub-cat-name/ -> get_the_category() returns an array of 2