# comment_text()

URL: https://chugunov.pro/api-wordpress/functions/comment_text/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 0.71.

## Сигнатура

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

## Описание

[See also](#see-also)
- [Walker_Comment::comment()](https://developer.wordpress.org/reference/classes/Walker_Comment/comment/)

## Параметры

- `$comment_id` `int|WP_Comment` — необязательный. WP_Comment или ID комментария, для которого нужно вывести текст.
  
  По умолчанию — текущий комментарий.
- `$args` `array` — необязательный, по умолчанию `array()`. Массив аргументов.

## Исходный код

Файл: `wp-includes/comment-template.php:1074`

```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 );
}
```

## История изменений

- 4.4.0 — Added the ability for $comment_id to also accept a WP_Comment object.
- 0.71 — Introduced.

## Связанные

Использует: [`get_comment_text`](https://chugunov.pro/api-wordpress/functions/get_comment_text/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_comment`](https://chugunov.pro/api-wordpress/functions/get_comment/).
Используется в: `WP_Comments_List_Table::column_comment`, `Walker_Comment::comment`, `Walker_Comment::html5_comment`.

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/comment_text/
