函数原型
add_comment_meta( int $comment_id, string $meta_key, mixed $meta_value, bool $unique = false ): int|false
函数描述
Adds meta data field to a comment.
是否弃用
未弃用
函数参数
-
$comment_id
int
Required -
Comment ID.
-
$meta_key
string
Required -
Metadata name.
-
$meta_value
mixed
Required -
Metadata value. Must be serializable if non-scalar.
-
$unique
bool
Optional -
Whether the same key should not be added.
Default:
false
函数返回值
int|false Meta ID on success, false on failure.
函数位置
File: wp-includes/comment.php
.
函数源码
function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) {
return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique );
}
源码链接
变更日志
Version | Description |
---|---|
2.9.0 | Introduced. |