函数原型
get_comment_meta( int $comment_id, string $key = ”, bool $single = false ): mixed
函数描述
Retrieves comment meta field for a comment.
是否弃用
未弃用
函数参数
-
$comment_id
int
Required - Comment ID.
-
$key
string
Optional - The meta key to retrieve. By default, returns data for all keys.
Default:
'' -
$single
bool
Optional - Whether to return a single value.
This parameter has no effect if$keyis not specified.
Default:
false
函数返回值
mixed An array of values if $single is false.
The value of meta data field if $single is true.
False for an invalid $comment_id (non-numeric, zero, or negative value).
An empty string if a valid but non-existing comment ID is passed.
函数位置
File: wp-includes/comment.php.
函数源码
function get_comment_meta( $comment_id, $key = '', $single = false ) {
return get_metadata( 'comment', $comment_id, $key, $single );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |

