W3cubDocs

/WordPress

serialize_blocks( array[] $blocks ): string

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

Parameters

$blocksarray[]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.

    Return

    string String of rendered HTML.

    Source

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

    Changelog

    Version Description
    5.3.1 Introduced.

You must log in before being able to contribute a note or feedback.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/serialize_blocks