# get_comment_delimited_block_content()

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

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

## Сигнатура

```php
get_comment_delimited_block_content( string|null $block_name, array $block_attributes, string $block_content ): string
```

## Описание

Возвращает содержимое блока, включая разделители-комментарии.

## Параметры

- `$block_name` `string|null` — обязательный. Имя блока. Null, если имя блока неизвестно; например, у классических блоков имя равно null.
- `$block_attributes` `array` — обязательный. Атрибуты блока.
- `$block_content` `string` — обязательный. Сохраняемое содержимое блока.

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

`string`

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

Файл: `wp-includes/blocks.php:1690`

```php
function get_comment_delimited_block_content( $block_name, $block_attributes, $block_content ) {
	if ( is_null( $block_name ) ) {
		return $block_content;
	}

	$serialized_block_name = strip_core_block_namespace( $block_name );
	$serialized_attributes = empty( $block_attributes ) ? '' : serialize_block_attributes( $block_attributes ) . ' ';

	if ( empty( $block_content ) ) {
		return sprintf( '<!-- wp:%s %s/-->', $serialized_block_name, $serialized_attributes );
	}

	return sprintf(
		'<!-- wp:%s %s-->%s<!-- /wp:%s -->',
		$serialized_block_name,
		$serialized_attributes,
		$block_content,
		$serialized_block_name
	);
}
```

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

- 5.3.1 — Introduced.

## Связанные

Использует: [`strip_core_block_namespace`](https://chugunov.pro/api-wordpress/functions/strip_core_block_namespace/), [`serialize_block_attributes`](https://chugunov.pro/api-wordpress/functions/serialize_block_attributes/).
Используется в: [`apply_block_hooks_to_content_from_post_object`](https://chugunov.pro/api-wordpress/functions/apply_block_hooks_to_content_from_post_object/), [`update_ignored_hooked_blocks_postmeta`](https://chugunov.pro/api-wordpress/functions/update_ignored_hooked_blocks_postmeta/), [`inject_ignored_hooked_blocks_metadata_attributes`](https://chugunov.pro/api-wordpress/functions/inject_ignored_hooked_blocks_metadata_attributes/), [`traverse_and_serialize_block`](https://chugunov.pro/api-wordpress/functions/traverse_and_serialize_block/), [`_build_block_template_result_from_file`](https://chugunov.pro/api-wordpress/functions/_build_block_template_result_from_file/), [`_build_block_template_result_from_post`](https://chugunov.pro/api-wordpress/functions/_build_block_template_result_from_post/), [`serialize_block`](https://chugunov.pro/api-wordpress/functions/serialize_block/).

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