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.


Parameters

$blocks

(array[])(Required)An array of representative arrays of parsed block objects. See serialize_block().


Top ↑

Return

(string) String of rendered HTML.


Top ↑

Source

File: wp-includes/blocks.php

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

Top ↑

Changelog

Changelog
VersionDescription
5.3.1Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.