get_term_parents_list()
get_term_parents_list( int $term_id, string $taxonomy, string|array $args = array() )
使用分隔符检索词条父项。
Retrieve term parents with separator.
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$term_id | (int) | 必需 | |
Term ID. | $taxonomy | 可选 | |
(Required) | Taxonomy name. | 可选 | |
(string|array) | (Optional) | 可选 | |
‘separator'(string) Separator for between the terms. Default ‘/’. | ‘link’(bool) Whether to format as a link. Default true. | 可选 |
返回(Return)
(string|WP_Error)成功时的词条父项、失败时的WP_Error或空string的列表。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
4.8.0 | wp-includes/category-template.php:1335 | 1 function | 7 |
笔记(Notes)
在类别存档页中显示术语父级的示例。在类别存档主题模板中使用此选项。
分类页面的面包屑跟踪示例。在主题的分类模板中使用它
get_term_parents_list() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_term_parents_list/