add_comment_meta( int $comment_id, string $meta_key, mixed $meta_value, bool $unique = false )

Add meta data field to a comment.

Description Description

Parameters Parameters


(int) (Required) Comment ID.


(string) (Required) Metadata name.


(mixed) (Required) Metadata value.


(bool) (Optional) Whether the same key should not be added.

Default value: false

Top ↑

Return Return

(int|bool) Meta ID on success, false on failure.

Top ↑

Source Source

File: wp-includes/comment.php

function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) {
	return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique );

Top ↑

Changelog Changelog

Version Description
2.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.