update_comment_meta

函数
update_comment_meta ( $comment_id, $meta_key, $meta_value, $prev_value = '' )
参数
  • (int) $comment_id Comment ID.
    Required:
  • (string) $meta_key Metadata key.
    Required:
  • (mixed) $meta_value Metadata value. Must be serializable if non-scalar.
    Required:
  • (mixed) $prev_value Optional. Previous value to check before updating. If specified, only update existing metadata entries with this value. Otherwise, update all entries. Default empty.
    Required:
    Default: (empty)
返回值
  • (int|bool) Meta ID if the key didn't exist, true on successful update, false on failure or if the value passed to the function is the same as the one that is already in the database.
定义位置
相关方法
delete_comment_metaupdate_comment_cacheupdate_post_metaget_comment_metaadd_comment_meta
引入
2.9.0
弃用
-

update_comment_meta: 这个函数更新一个评论的元数据。它需要三个参数:评论ID,元密钥,和元值。

根据评论ID更新评论元域。

使用$prev_value参数来区分具有相同键和评论ID的元字段。

如果该评论的元字段不存在,它将被添加。

function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = '' ) {
	return update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 19:32:59

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: