Title: comment_text
Published: April 25, 2014
Last modified: August 20, 2026

---

# comment_text( int|WP_Comment $comment_id, array $args = array() )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#wp--skip-link--target)

Displays the text of the current comment.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#see-also)󠁿

 * [Walker_Comment::comment()](https://developer.wordpress.org/reference/classes/Walker_Comment/comment/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#parameters)󠁿

 `$comment_id`int|[WP_Comment](https://developer.wordpress.org/reference/classes/wp_comment/)
optional

[WP_Comment](https://developer.wordpress.org/reference/classes/wp_comment/) or ID
of the comment for which to print the text.
 Default current comment.

`$args`arrayoptional

An array of arguments.

Default:`array()`

## 󠀁[Source](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#source)󠁿

    ```php
    function comment_text( $comment_id = 0, $args = array() ) {
    	$comment = get_comment( $comment_id );

    	$comment_text = get_comment_text( $comment, $args );

    	/**
    	 * Filters the text of a comment to be displayed.
    	 *
    	 * @since 1.2.0
    	 *
    	 * @see Walker_Comment::comment()
    	 *
    	 * @param string          $comment_text Text of the comment.
    	 * @param WP_Comment|null $comment      The comment object. Null if not found.
    	 * @param array           $args         An array of arguments.
    	 */
    	echo apply_filters( 'comment_text', $comment_text, $comment, $args );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/comment-template.php#L1074)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/comment-template.php#L1074-L1091)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#hooks)󠁿

 [apply_filters( ‘comment_text’, string $comment_text, WP_Comment|null $comment, array $args )](https://developer.wordpress.org/reference/hooks/comment_text/)

Filters the text of a comment to be displayed.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#related)󠁿

| Uses | Description | 
| [get_comment_text()](https://developer.wordpress.org/reference/functions/get_comment_text/)`wp-includes/comment-template.php` |

Retrieves the text of the current comment.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  | 
| [get_comment()](https://developer.wordpress.org/reference/functions/get_comment/)`wp-includes/comment.php` |

Retrieves comment data given a comment ID or comment object.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#)

| Used by | Description | 
| [WP_Comments_List_Table::column_comment()](https://developer.wordpress.org/reference/classes/wp_comments_list_table/column_comment/)`wp-admin/includes/class-wp-comments-list-table.php` |

Outputs the comment column.

  | 
| [Walker_Comment::comment()](https://developer.wordpress.org/reference/classes/walker_comment/comment/)`wp-includes/class-walker-comment.php` |

Outputs a single comment.

  | 
| [Walker_Comment::html5_comment()](https://developer.wordpress.org/reference/classes/walker_comment/html5_comment/)`wp-includes/class-walker-comment.php` |

Outputs a comment in the HTML5 format.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability for `$comment_id` to also accept a [WP_Comment](https://developer.wordpress.org/reference/classes/wp_comment/) object. | 
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/comment_text/?output_format=md#comment-content-1199)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/comment_text/#comment-1199)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fcomment_text%2F%23comment-1199)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fcomment_text%2F%23comment-1199)
 4. **Basic Example**
 5. Displays the comment text with the comment author in a list () tag.
 6.     ```php
        <ul>
        	<li>
        		<?php printf( __( 'Comment by %s:', 'textdomain' ), get_comment_author() ); ?><br />
        		<?php comment_text(); ?>
        	</li>
        </ul>
        ```
    
 7.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fcomment_text%2F%3Freplytocom%3D1199%23feedback-editor-1199)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fcomment_text%2F)
before being able to contribute a note or feedback.