禁止使用模板插件做违法内容(涉黄等),否则将受到法律的制裁。

WordPress函数get_edit_term_link详细用法教程解析

禁止使用模板插件做违法内容(涉黄等),否则将受到法律的制裁。

get_edit_term_link函数是WordPress中用于获取编辑分类或标签链接的函数。它的基本语法如下:

get_edit_term_link( $term_id, $taxonomy, $object_type, $deprecated )

参数说明:

- $term_id:必需,表示分类或标签的ID。
- $taxonomy:必需,表示分类法的名称。
- $object_type:可选,表示分类法的对象类型。
- $deprecated:可选,已弃用。

以下是具体的使用示例:

1. 获取编辑分类链接:

$term_id = 1;
$taxonomy = 'category';
$edit_link = get_edit_term_link( $term_id, $taxonomy );
echo $edit_link;

上述示例中,$term_id为1,$taxonomy为'category',即获取ID为1的分类的编辑链接。

2. 获取编辑标签链接:

$term_id = 1;
$taxonomy = 'post_tag';
$edit_link = get_edit_term_link( $term_id, $taxonomy );
echo $edit_link;

上述示例中,$term_id为1,$taxonomy为'post_tag',即获取ID为1的标签的编辑链接。

需要注意的是,如果在自定义分类法中使用该函数,则需要指定$object_type参数来指定对象类型。

$term_id = 1;
$taxonomy = 'custom_taxonomy';
$object_type = 'custom_post_type';
$edit_link = get_edit_term_link( $term_id, $taxonomy, $object_type );
echo $edit_link;

上述示例中,$term_id为1,$taxonomy为'custom_taxonomy',$object_type为'custom_post_type',即获取ID为1的自定义分类的编辑链接。

0 个评论

 
联系
目前暂停一切业务,客服消息可能不会及时回复,谢谢理解。
在线咨询
    在线咨询
    禁止使用模板插件做违法内容(涉黄等),否则将受到法律的制裁。