How do I get current taxonomy term id on WordPress?
问题 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 回答1: Nevermind! I found it :) get_queried_object()->term_id; 回答2: Here's the whole code snippet needed: $queried_object = get_queried_object(); $term_id = $queried_object->term_id; 回答3: Simple and easy! get_queried_object_id() 回答4: Just copy paste below code! This will print your current