Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
How can I retrieve slug of current taxonomy being viewed in taxonomy template? I tried to codex but found nothing on taxonomy template page.
To further explain, lets say I am viewing category flowers so how can I retrieve slug of category flowers?
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();
Required, but never shown