add_comment_meta()

最后更新于:2021-11-25 19:09:23

add_comment_meta( int$comment_id, string$meta_key, mixed$meta_value, bool$unique=false)

Add 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 value: false

响应

(int|false) Meta ID on success, false on failure.

源文件

文件: gc-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 );
}