On this page
add_comment_meta( int $comment_id, string $meta_key, mixed $meta_value, bool $unique = false ): int|false
Adds meta data field to a comment.
Parameters
$comment_idint Required-
Comment ID.
$meta_keystring Required-
Metadata name.
$meta_valuemixed Required-
Metadata value. Must be serializable if non-scalar.
$uniquebool Optional-
Whether the same key should not be added.
Default:
false
Return
int|false Meta ID on success, false on failure.
Source
File: wp-includes/comment.php. View all references
function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) {
return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique );
}
Related
Uses
| Uses | Description |
|---|---|
| add_metadata() wp-includes/meta.php | Adds metadata for the specified object. |
Used By
| Used By | Description |
|---|---|
| wp_spam_comment() wp-includes/comment.php | Marks a comment as Spam. |
| wp_insert_comment() wp-includes/comment.php | Inserts a comment into the database. |
| wp_trash_comment() wp-includes/comment.php | Moves a comment to the Trash |
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/add_comment_meta