get_edit_tag_link()
云策文档标注
概述
get_edit_tag_link() 函数用于获取标签(或分类法中的术语)的编辑链接 URL。它基于 get_edit_term_link() 实现,并提供了一个过滤器钩子以允许自定义链接。
关键要点
- 函数接受两个参数:$tag(必需,可以是标签 ID、WP_Term 对象或通用对象)和 $taxonomy(可选,分类法 slug,默认为 'post_tag')。
- 返回值为字符串,表示给定标签的编辑链接 URL。
- 内部使用 apply_filters('get_edit_tag_link', ...) 钩子,允许开发者过滤编辑链接。
- 相关函数包括 get_edit_term_link() 和 apply_filters()。
- 自 WordPress 2.7.0 版本引入。
原文内容
Retrieves the edit link for a tag.
Parameters
$tagint|WP_Term|objectrequired-
The ID or term object whose edit link will be retrieved.
$taxonomystringoptional-
Taxonomy slug. Default
'post_tag'.
Source
function get_edit_tag_link( $tag, $taxonomy = 'post_tag' ) {
/**
* Filters the edit link for a tag (or term in another taxonomy).
*
* @since 2.7.0
*
* @param string $link The term edit link.
*/
return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag, $taxonomy ) );
}
Hooks
- apply_filters( ‘get_edit_tag_link’, string $link )
-
Filters the edit link for a tag (or term in another taxonomy).
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |