get_comment_ID

Retrieve the comment id of the current comment.

Description

(int) get_comment_ID(); 

Returns (int)

The comment ID.


Usage

  1. if ( !function_exists( 'get_comment_ID' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_comment_ID(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/comment-template.php  
  1. function get_comment_ID() { 
  2. $comment = get_comment(); 
  3.  
  4. /** 
  5. * Filters the returned comment ID. 
  6. * @since 1.5.0 
  7. * @since 4.1.0 The `$comment_ID` parameter was added. 
  8. * @param int $comment_ID The current comment ID. 
  9. * @param WP_Comment $comment The comment object. 
  10. */ 
  11. return apply_filters( 'get_comment_ID', $comment->comment_ID, $comment );