W3cubDocs

/WordPress

remove_serialized_parent_block( string $serialized_block ): string

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

Parameters

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

Return

string The serialized markup of the inner blocks.

Source

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

Changelog

Version Description
6.6.0 Introduced.

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