serialize_blocks() WordPress Function
The serialize_blocks() function in WordPress takes an array of block objects and turns them into a string of serialized blocks. This is useful for storing blocks in a database or file.
serialize_blocks( array[] $blocks ) #
Returns a joined string of the aggregate serialization of the given parsed blocks.
Contents
Parameters
- $blocks
(array[])(Required)An array of representative arrays of parsed block objects. See serialize_block().
Return
(string) String of rendered HTML.
Source
File: wp-includes/blocks.php
function serialize_blocks( $blocks ) { return implode( '', array_map( 'serialize_block', $blocks ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.3.1 | Introduced. |