[英]Get the terms from a custom taxonomy without posts
What I am asking is, is there a built-in function that gets the the result of the following mysql query? 我要问的是,是否有内置函数获取以下mysql查询的结果? get_terms()
seems to get only the terms that are assigned eg to a post and not the whole list. get_terms()
似乎仅获得分配给例如帖子的术语,而不是整个列表。
select
name
from
wordpress.wp_terms
where
term_id in (select
term_id
FROM
wordpress.wp_term_taxonomy
where
taxonomy = 'custome_taxonomy')
I think you have a misunderstanding about get_terms
and don't know the purpose of the arguments within get_terms
我认为您对get_terms
有误解,也不知道get_terms
参数的目的
By default, all terms without posts are hidden, here is the argument 默认情况下,所有没有帖子的术语都是隐藏的,这是参数
'hide_empty' => true,
To retrieve terms without posts, you'll need to pass false to the hide_empty
argument, like this 要检索没有帖子的术语,您需要将false传递给hide_empty
参数,就像这样
$terms = get_terms( 'hide_empty=false' );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.