# image_media_send_to_editor()

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

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

## Сигнатура

```php
image_media_send_to_editor( string $html, int $attachment_id, array $attachment ): string
```

## Описание

Получает HTML-код медиаэлемента для отправки в редактор.

## Параметры

- `$html` `string` — обязательный
- `$attachment_id` `int` — обязательный
- `$attachment` `array` — обязательный

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

`string`

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

Файл: `wp-admin/includes/media.php:1377`

```php
function image_media_send_to_editor( $html, $attachment_id, $attachment ) {
	$post = get_post( $attachment_id );

	if ( str_starts_with( $post->post_mime_type, 'image' ) ) {
		$url   = $attachment['url'];
		$align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none';
		$size  = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
		$alt   = ! empty( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';
		$rel   = ( str_contains( $url, 'attachment_id' ) || get_attachment_link( $attachment_id ) === $url );

		return get_image_send_to_editor( $attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt );
	}

	return $html;
}
```

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

- 2.5.0 — Introduced.

## Связанные

Использует: [`get_image_send_to_editor`](https://chugunov.pro/api-wordpress/functions/get_image_send_to_editor/), [`get_attachment_link`](https://chugunov.pro/api-wordpress/functions/get_attachment_link/), [`get_post`](https://chugunov.pro/api-wordpress/functions/get_post/).

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