# rest_insert_comment

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

Тип: хук-действие.
Появился в версии: 4.7.0.

## Сигнатура

```php
do_action( 'rest_insert_comment', WP_Comment $comment, WP_REST_Request $request, bool $creating )
```

## Описание

Срабатывает после создания или обновления комментария через REST API.

## Параметры

- `$comment` `WP_Comment` — обязательный. Вставленный или обновлённый объект комментария.
- `$request` `WP_REST_Request` — обязательный. Объект запроса.
- `$creating` `bool` — обязательный. True при создании комментария, false при обновлении.

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

Файл: `wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:819`

```php
do_action( 'rest_insert_comment', $comment, $request, true );
```

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

- 4.7.0 — Introduced.

## Связанные

Используется в: `WP_REST_Comments_Controller::update_item`, `WP_REST_Comments_Controller::create_item`.

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