How to get slug of current category in taxonomy template?

You can get the term object of the category you’re viewing with get_queried_object(). That will contain the slug.

$term = get_queried_object();
echo $term->slug;

Leave a Comment