WordPress at a glance

get_comment_meta() WP 1.0

Retrieve comment meta field for a comment.

Works based on: get_metadata()
✈ 1 time = 0.000503s = slow | 50000 times = 0.12s = very fast | PHP 7.0.2, WP 4.4.2

No Hooks.


Mixed. Will be an array if $single is false. Will be value of meta data field if $single is true.


get_comment_meta( $comment_id, $key, $single );
$comment_id(int) (required)
Comment ID.
The meta key to retrieve. By default, returns data for all keys.
Default: ''
Whether to return a single value.
Default: false


Since 2.9.0 Introduced.

Code of get comment meta: wp-includes/comment.php WP 5.4.2

function get_comment_meta( $comment_id, $key = '', $single = false ) {
	return get_metadata( 'comment', $comment_id, $key, $single );

Related Functions

From tag: Metadatas (any)

No comments
        Log In . Register