add_comment_meta( int $comment_id, string $meta_key, mixed $meta_value, bool $unique = false )
Add meta data field to a comment.
Parameters
- $comment_id
-
(Required) Comment ID.
- $meta_key
-
(Required) Metadata name.
- $meta_value
-
(Required) Metadata value.
- $unique
-
(Optional) Whether the same key should not be added.
Default value: false
Return
(int|bool) Meta ID on success, false on failure.
Source
File: wp-includes/comment.php
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) {
$added = add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique );
if ( $added ) {
wp_cache_set( 'last_changed', microtime(), 'comment' );
}
return $added;
}
Changelog
Version | Description |
---|---|
WP-2.9.0 | Introduced. |