add_comment_meta

The timeline below displays how wordpress function add_comment_meta has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

//
// Comment meta functions.
//
/**
 * Adds meta data field to a comment.
 *
 * @since 2.9.0
 *
 * @link https://developer.wordpress.org/reference/functions/add_comment_meta/
 *
 * @param int    $comment_id Comment ID.
 * @param string $meta_key   Metadata name.
 * @param mixed  $meta_value Metadata value. Must be serializable if non-scalar.
 * @param bool   $unique     Optional. Whether the same key should not be added.
 *                           Default false.
 * @return int|false Meta ID on success, false on failure.
 */
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
{
    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
}

WordPress Version: 5.7

//
// Comment meta functions.
//
/**
 * Add meta data field to a comment.
 *
 * @since 2.9.0
 *
 * @link https://developer.wordpress.org/reference/functions/add_comment_meta/
 *
 * @param int    $comment_id Comment ID.
 * @param string $meta_key   Metadata name.
 * @param mixed  $meta_value Metadata value. Must be serializable if non-scalar.
 * @param bool   $unique     Optional. Whether the same key should not be added.
 *                           Default false.
 * @return int|false Meta ID on success, false on failure.
 */
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
{
    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
}

WordPress Version: 5.5

//
// Comment meta functions.
//
/**
 * Add meta data field to a comment.
 *
 * @since 2.9.0
 *
 * @link https://developer.wordpress.org/reference/functions/add_comment_meta/
 *
 * @param int    $comment_id Comment ID.
 * @param string $meta_key   Metadata name.
 * @param mixed  $meta_value Metadata value. Must be serializable if non-scalar.
 * @param bool   $unique     Optional. Whether the same key should not be added.
 *                           Default false.
 * @return int|bool Meta ID on success, false on failure.
 */
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
{
    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
}

WordPress Version: 5.4

//
// Comment meta functions.
//
/**
 * Add meta data field to a comment.
 *
 * @since 2.9.0
 * @link https://developer.wordpress.org/reference/functions/add_comment_meta/
 *
 * @param int $comment_id Comment ID.
 * @param string $meta_key Metadata name.
 * @param mixed $meta_value Metadata value.
 * @param bool $unique Optional, default is false. Whether the same key should not be added.
 * @return int|bool Meta ID on success, false on failure.
 */
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
{
    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
}

WordPress Version: 5.3

//
// Comment meta functions
//
/**
 * Add meta data field to a comment.
 *
 * @since 2.9.0
 * @link https://developer.wordpress.org/reference/functions/add_comment_meta/
 *
 * @param int $comment_id Comment ID.
 * @param string $meta_key Metadata name.
 * @param mixed $meta_value Metadata value.
 * @param bool $unique Optional, default is false. Whether the same key should not be added.
 * @return int|bool Meta ID on success, false on failure.
 */
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
{
    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
}

WordPress Version: 5.0

//
// Comment meta functions
//
/**
 * Add meta data field to a comment.
 *
 * @since 2.9.0
 * @link https://codex.wordpress.org/Function_Reference/add_comment_meta
 *
 * @param int $comment_id Comment ID.
 * @param string $meta_key Metadata name.
 * @param mixed $meta_value Metadata value.
 * @param bool $unique Optional, default is false. Whether the same key should not be added.
 * @return int|bool Meta ID on success, false on failure.
 */
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
{
    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
}

WordPress Version: 4.9

//
// Comment meta functions
//
/**
 * Add meta data field to a comment.
 *
 * @since 2.9.0
 * @link https://codex.wordpress.org/Function_Reference/add_comment_meta
 *
 * @param int $comment_id Comment ID.
 * @param string $meta_key Metadata name.
 * @param mixed $meta_value Metadata value.
 * @param bool $unique Optional, default is false. Whether the same key should not be added.
 * @return int|bool Meta ID on success, false on failure.
 */
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;
}

WordPress Version: 4.2

//
// Comment meta functions
//
/**
 * Add meta data field to a comment.
 *
 * @since 2.9.0
 * @link https://codex.wordpress.org/Function_Reference/add_comment_meta
 *
 * @param int $comment_id Comment ID.
 * @param string $meta_key Metadata name.
 * @param mixed $meta_value Metadata value.
 * @param bool $unique Optional, default is false. Whether the same key should not be added.
 * @return int|bool Meta ID on success, false on failure.
 */
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
{
    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
}

WordPress Version: 4.1

//
// Comment meta functions
//
/**
 * Add meta data field to a comment.
 *
 * @since 2.9.0
 * @link http://codex.wordpress.org/Function_Reference/add_comment_meta
 *
 * @param int $comment_id Comment ID.
 * @param string $meta_key Metadata name.
 * @param mixed $meta_value Metadata value.
 * @param bool $unique Optional, default is false. Whether the same key should not be added.
 * @return int|bool Meta ID on success, false on failure.
 */
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
{
    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
}

WordPress Version: 3.7

//
// Comment meta functions
//
/**
 * Add meta data field to a comment.
 *
 * @since 2.9.0
 * @uses add_metadata
 * @link http://codex.wordpress.org/Function_Reference/add_comment_meta
 *
 * @param int $comment_id Comment ID.
 * @param string $meta_key Metadata name.
 * @param mixed $meta_value Metadata value.
 * @param bool $unique Optional, default is false. Whether the same key should not be added.
 * @return int|bool Meta ID on success, false on failure.
 */
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
{
    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
}