serialize_blocks()WP 5.3.1

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

No Hooks.

Returns

String. String of rendered HTML.

Usage

serialize_blocks( $blocks );
$blocks(array[]) (required)

Array of block structures.

  • ...$0(array)
    An associative array of a single parsed block object. See WP_Block_Parser_Block.

    • blockName(string)
      Name of block.

    • attrs(array)
      Attributes from block comment delimiters.

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

    • innerHTML(string)
      HTML from inside block comment delimiters.

    • innerContent(array)
      List of string fragments and null markers where inner blocks were found.

Changelog

Since 5.3.1 Introduced.

serialize_blocks() code WP 6.8.3

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