WordPress at a glance

comment_ID() WP 0.71

Displays the ID of the current comment. Uses in a comments loop.

Works based on: get_comment_ID()

No Hooks.

Return

Nothing (null). Displays the result of the get_comment_ID() function.

Usage

<?php comment_ID(); ?>

Examples

#1. Get the link with anchor text on the comment

With text which is the name of the commentator. The code should be used in a comment loop:

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

Code of comment_ID: wp-includes/comment-template.php VER 4.9.8

<?php
function comment_ID() {
	echo get_comment_ID();
}

Related Functions

From category: Comments Loop

More from Template Tags: Comments

No comments
    Hello, !     Log In . Register