添加标签到帖子。
原型
wp_add_post_tags( int $post_id, string|array $tags = '' )
参数
$post_id
(int)
(Optional)
邮政编码。不默认为全局$ post的ID。
$tags
(string|array)
(Optional)
要为帖子设置的标记数组,或者用逗号分隔的标记字符串。
返回值
(array|false|WP_Error)
受影响的术语ID数组。
源文件
路径:wp-includes/post.php
<?php
...
function wp_add_post_tags( $post_id = 0, $tags = '' ) {
return wp_set_post_tags($post_id, $tags, true);
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_add_post_tags/