Adds meta data field to a comment.
Parameters
$comment_id
intrequired- Comment ID.
$meta_key
stringrequired- Metadata name.
$meta_value
mixedrequired- Metadata value. Must be serializable if non-scalar.
$unique
booloptional- Whether the same key should not be added.
Default:
false
Source
function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) {
return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique );
}
Changelog
Version | Description |
---|---|
2.9.0 | Introduced. |
Basic Example
Add a custom posted value to every new comment