wp_set_post_terms(int $ post_id, string | array $ tags = ”, string $ taxonomy = ‘post_tag’, bool $ append = false )
设置帖子的条款。
描述#描述
另见#另见
wp_set_object_terms()
wp_set_post_terms参数#
$post_id
(int) (可选) 帖子ID。不默认为全局$ post的ID。
$tags
(string | array) (可选) 要为帖子设置的术语数组,或用逗号分隔的术语字符串。
默认值: ”
$taxonomy
(字符串) (可选) 分类名称。
默认值:’post_tag’
$append
(bool) (可选) 如果为true,请不要删除现有术语,只需添加即可。如果为false,请将条款替换为新条款。
默认值:false
这里比传统只创建默认文章类型的wp_set_post_tags()函数要好玩的多,可以很方便为自己创建其它自定义类型方便的创建标签