将元数据字段添加到评论中。
原型
add_comment_meta( int $comment_id, string $meta_key, mixed $meta_value, bool $unique = false )
参数
$comment_id
(int)
(Required)
评论ID。
$meta_key
(string)
(Required)
元数据名称。
$meta_value
(mixed)
(Required)
元数据价值。
$unique
(bool)
(Optional)
是否不应添加相同的密钥。
返回值
(int|bool)
成功时的元ID,失败时的假。
源文件
路径:wp-includes/comment.php
<?php
...
function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) {
return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/add_comment_meta/