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.


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


<?php comment_ID(); ?>


#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>


Since 0.71 Introduced.

Code of comment ID: wp-includes/comment-template.php WP 5.2.3

function comment_ID() {
	echo get_comment_ID();

Related Functions

From category: Comments Loop

More from Template Tags: Comments

No comments
    Hello, !     Log In . Register