extract_serialized_parent_block()
Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the wrapper block.
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.
Returns
String. The serialized markup of the wrapper block.
Usage
extract_serialized_parent_block( $serialized_block );
- $serialized_block(string) (required)
- The serialized markup of a block and its inner blocks.
Notes
Changelog
| Since 6.7.0 | Introduced. |
extract_serialized_parent_block() extract serialized parent block code WP 6.9.1
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 );
}