add_comment_meta()
add_comment_meta( int $comment_id, string $meta_key, mi…
add_comment_meta( int $comment_id, string $meta_key, mixed $meta_value, bool $unique = false )
向注释添加元数据字段。
Add meta data field to a comment.
向注释添加元数据字段。
Add meta data field to a comment.
目录锚点:#参数#返回#源码#笔记
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $comment_id | (int) | 必需 | 注释ID。 |
| $meta_key | (string) | 必需 | 元数据名称。 |
| $meta_value | (mixed) | 必需 | 元数据值。 |
| $unique | (bool) | 可选 | 是否不应添加相同的密钥。 |
返回(Return)
(int|bool)成功时为Meta ID,失败时为false。
源码(Source)
/**
* 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);
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.9.0 | wp-includes/comment.php:456 | 3 | 1 function |
笔记(Notes)
基本示例
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!