serialize_blocks()WP 5.3.1

Returns a joined string of the aggregate serialization of the given parsed blocks.

Хуков нет.

Возвращает

Строку. String of rendered HTML.

Использование

serialize_blocks( $blocks );
$blocks(array[]) (обязательный)

Array of block structures.

  • ...$0(массив)
    An associative array of a single parsed block object. See WP_Block_Parser_Block.

    • blockName(строка)
      Name of block.

    • attrs(массив)
      Attributes from block comment delimiters.

    • innerBlocks(array[])
      List of inner blocks. An array of arrays that have the same structure as this one.

    • innerHTML(строка)
      HTML from inside block comment delimiters.

    • innerContent(массив)
      List of string fragments and null markers where inner blocks were found.

Список изменений

С версии 5.3.1 Введена.

Код serialize_blocks() WP 6.8

function serialize_blocks( $blocks ) {
	return implode( '', array_map( 'serialize_block', $blocks ) );
}