WPDev.one
Core Function
View Source on Trac ↗

update_comment_meta()

update_comment_meta( mixed $comment_id, mixed $meta_key, mixed $meta_value, mixed $prev_value = '' )

Updates comment meta field based on comment ID.

Parameters 4 required

Name / Type Description
$comment_id
int

Comment ID.

Required
$meta_key
string

Metadata key.

Required
$meta_value
mixed

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 string.

Required

Return Value

((int)
(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.

Function Information

Since Version
2.9.0
Source File
wp-includes/comment.php
Advertisement