comment_text

Display the text of the current comment.

Description

comment_text( (int) $comment_ID = 0, (array) $args = array() ); 

Parameters (2)

0. $comment_id (int)
WP_Comment or ID of the comment for which to print the text. Default current comment.
1. $args — Optional. (array) => array()
An array of arguments. Default empty array. Default empty.

Usage

  1. if ( !function_exists( 'comment_text' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment-template.php'; 
  3.  
  4. // WP_Comment or ID of the comment for which to print the text. 
  5. // Default current comment. 
  6. $comment_id = -1; 
  7.  
  8. // Optional. An array of arguments. Default empty array. Default empty. 
  9. $args = array(); 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = comment_text($comment_id, $args); 
  13.  

Defined (1)

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

/wp-includes/comment-template.php  
  1. function comment_text( $comment_ID = 0, $args = array() ) { 
  2. $comment = get_comment( $comment_ID ); 
  3.  
  4. $comment_text = get_comment_text( $comment, $args ); 
  5. /** 
  6. * Filters the text of a comment to be displayed. 
  7. * @since 1.2.0 
  8. * @see Walker_Comment::comment() 
  9. * @param string $comment_text Text of the current comment. 
  10. * @param WP_Comment $comment The comment object. 
  11. * @param array $args An array of arguments. 
  12. */ 
  13. echo apply_filters( 'comment_text', $comment_text, $comment, $args );