Use the $prev_value parameter to differentiate between meta fields with the same key and comment ID. If the meta field for the comment does not exist, it will be added.
Parameters
$comment_idint
Comment ID.
$meta_keystring
Metadata key.
$meta_valuemixed
Metadata value. Must be serializable if non-scalar.
$prev_valuemixedoptional
Previous value to check before updating. If specified, only update existing metadata entries with this value. Otherwise, update all entries. Default empty string.Default: ''
Return
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.
Uses · 1
update_metadata()Updates metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/comment.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.