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;
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;