Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the wrapper block.
$serialized_blockstringrequired
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 );
}
| Version | Description |
|---|---|
| 6.7.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/extract_serialized_parent_block