WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get comment ID

This page is marked as incomplete. You can help Codex by expanding it.

Description

Retrieve the comment id of the current comment.

Usage

<?php $comment_id get_comment_ID(); ?>

Parameters

This function does not accept parameters

Return Values

(integer) 
The comment ID

Examples

Uses the comment ID as an anchor id for a comment.

<?php $comment_id = get_comment_ID(); ?>

<div id="comment-<?php echo $comment_id; ?>">Comment by 
<?php comment_author() ?>: </div>
<div class="comment-text"><?php comment_text() ?></div>

Notes

Change Log

Since: 1.5.0

Source File

get_comment_ID() is located in wp-includes/comment-template.php

Related