# get_comment_to_edit()

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

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

## Сигнатура

```php
get_comment_to_edit( int $id ): WP_Comment|false
```

## Описание

Возвращает объект WP_Comment по идентификатору комментария.

## Параметры

- `$id` `int` — обязательный. Идентификатор комментария для получения.

## Возвращаемое значение

`WP_Comment|false`

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

Файл: `wp-admin/includes/comment.php:110`

```php
function get_comment_to_edit( $id ) {
	$comment = get_comment( $id );
	if ( ! $comment ) {
		return false;
	}

	$comment->comment_ID      = (int) $comment->comment_ID;
	$comment->comment_post_ID = (int) $comment->comment_post_ID;

	$comment->comment_content = format_to_edit( $comment->comment_content );
	/**
	 * Filters the comment content before editing.
	 *
	 * @since 2.0.0
	 *
	 * @param string $comment_content Comment content.
	 */
	$comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content );

	$comment->comment_author       = format_to_edit( $comment->comment_author );
	$comment->comment_author_email = format_to_edit( $comment->comment_author_email );
	$comment->comment_author_url   = format_to_edit( $comment->comment_author_url );
	$comment->comment_author_url   = esc_url( $comment->comment_author_url );

	return $comment;
}
```

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

- 2.0.0 — Introduced.

## Связанные

Использует: [`format_to_edit`](https://chugunov.pro/api-wordpress/functions/format_to_edit/), [`esc_url`](https://chugunov.pro/api-wordpress/functions/esc_url/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_comment`](https://chugunov.pro/api-wordpress/functions/get_comment/).

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