[英]Get the terms from a custom taxonomy without posts
我要问的是,是否有内置函数获取以下mysql查询的结果? get_terms()
似乎仅获得分配给例如帖子的术语,而不是整个列表。
select
name
from
wordpress.wp_terms
where
term_id in (select
term_id
FROM
wordpress.wp_term_taxonomy
where
taxonomy = 'custome_taxonomy')
我认为您对get_terms
有误解,也不知道get_terms
参数的目的
默认情况下,所有没有帖子的术语都是隐藏的,这是参数
'hide_empty' => true,
要检索没有帖子的术语,您需要将false传递给hide_empty
参数,就像这样
$terms = get_terms( 'hide_empty=false' );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.