根据评论ID更新评论元字段。
原型
update_comment_meta( int $comment_id, string $meta_key, mixed $meta_value, mixed $prev_value = '' )
描述
使用$ prev_value参数来区分具有相同键和注释ID的元字段。
参数
$comment_id
(int)
(Required)
评论ID。
$meta_key
(string)
(Required)
元数据键。
$meta_value
(mixed)
(Required)
元数据价值。
$prev_value
(mixed)
(Optional)
要删除之前要检查的上一个值。
返回值
(int|bool)
如果密钥不存在则为元ID,成功更新时为true,失败时为false。
源文件
路径:wp-includes/comment.php
<?php
...
function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = '' ) {
return update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/update_comment_meta/