taxonomy_labels_{$taxonomy}
云策文档标注
概述
taxonomy_labels_{$taxonomy} 是一个 WordPress 过滤器钩子,用于修改特定分类法的标签对象。它允许开发者自定义分类法的标签,如名称、单数形式等。
关键要点
- 这是一个动态钩子,$taxonomy 部分替换为分类法的 slug,例如 taxonomy_labels_category 或 taxonomy_labels_post_tag。
- 钩子接收一个 $labels 对象参数,包含分类法的所有标签成员变量。
- 主要用于 get_taxonomy_labels() 函数中,构建分类法标签对象。
代码示例
$labels = apply_filters( "taxonomy_labels_{$taxonomy}", $labels );注意事项
- 此钩子自 WordPress 4.4.0 版本引入。
- 参考 get_taxonomy_labels() 函数以获取完整的标签列表。
原文内容
Filters the labels of a specific taxonomy.
Description
The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.
Possible hook names include:
taxonomy_labels_categorytaxonomy_labels_post_tag
See also
- get_taxonomy_labels(): for the full list of taxonomy labels.
Parameters
$labelsobject-
Object with labels for the taxonomy as member variables.
Source
$labels = apply_filters( "taxonomy_labels_{$taxonomy}", $labels );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |