如何在WordPress上获取当前的分类术语ID? [英] How do I get current taxonomy term id on WordPress?
本文介绍了如何在WordPress上获取当前的分类术语ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在WordPress主题文件夹中创建了一个taxonomy.php页面.我想获取函数的当前术语ID. 我怎么能得到这个?
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')
仅返回词条,我想要ID
get_query_var('taxonomy')
only returns the term slug, I want the ID
推荐答案
没关系!我找到了:)
get_queried_object()->term_id;
这篇关于如何在WordPress上获取当前的分类术语ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文