remove_serialized_parent_block()WP 6.6.0

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

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

String. The serialized markup of the inner blocks.

Usage

remove_serialized_parent_block( $serialized_block );
$serialized_block(string) (required)
The serialized markup of a block and its inner blocks.

Changelog

Since 6.6.0 Introduced.

remove_serialized_parent_block() code WP 6.6.1

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