How to get the current taxonomy term ID (not the slug) in WordPress?

127

I've created a taxonomy.php page in my WordPress theme folder. I would like to get the current term id for a function. How can I get this?

get_query_var('taxonomy') only returns the term slug, I want the ID

This question is tagged with php wordpress taxonomy

~ Asked on 2012-09-05 20:21:50

The Best Answer is


317

Nevermind! I found it :)

get_queried_object()->term_id;

~ Answered on 2012-09-05 20:32:02


54

Simple and easy!

get_queried_object_id()

~ Answered on 2017-03-21 13:27:12


Most Viewed Questions: