extract_serialized_parent_block( string $serialized_block ): string

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use remove_serialized_parent_block() instead.

Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the wrapper block.

Description

See also

Parameters

$serialized_blockstringrequired
The serialized markup of a block and its inner blocks.

Return

string The serialized markup of the wrapper block.

Source

function extract_serialized_parent_block( $serialized_block ) {
	$start = strpos( $serialized_block, '-->' ) + strlen( '-->' );
	$end   = strrpos( $serialized_block, '<!--' );
	return substr( $serialized_block, 0, $start ) . substr( $serialized_block, $end );
}

Changelog

VersionDescription
6.7.0Introduced.

User Contributed Notes

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