get_comment_meta()
get_comment_meta( int $comment_id, string $key = ”, boo…
get_comment_meta( int $comment_id, string $key = ”, bool $single = false )
检索注释的注释元字段。
Retrieve comment meta field for a comment.
检索注释的注释元字段。
Retrieve comment meta field for a comment.
目录锚点:#参数#返回#源码#笔记
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $comment_id | (int) | 必需 | 注释ID。 |
| $key | (string) | 可选 | 要检索的元密钥。默认情况下,返回所有键的数据。 |
| $single | (bool) | 可选 | 是否返回单个值。 |
返回(Return)
(mixed)将是一个数组,如果$single为false。如果$single为true,则为元数据字段的值。
源码(Source)
/**
* Retrieve comment meta field for a comment.
*
* @since 2.9.0
* @link https://codex.wordpress.org/Function_Reference/get_comment_meta
*
* @param int $comment_id Comment ID.
* @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
* @param bool $single Whether to return a single value.
* @return mixed Will be an array if $single is false. Will be value of meta data field if $single
* is true.
*/
function get_comment_meta($comment_id, $key = '', $single = false) {
return get_metadata('comment', $comment_id, $key, $single);
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.9.0 | wp-includes/comment.php:491 | 3 | 1 function |
笔记(Notes)
基本示例
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。




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