]*wp-block-group__inner-container(\s|")[^>]*>)((.|\S|\s)*)/';
// TODO: Add check for theme.json presence.
if (
'core/group' !== $block['blockName'] ||
1 === preg_match( $group_with_inner_container_regex, $block_content )
) {
return $block_content;
}
$replace_regex = '/(^\s*
]*wp-block-group[^>]*>)(.*)(<\/div>\s*$)/ms';
$updated_content = preg_replace_callback(
$replace_regex,
function( $matches ) {
return $matches[1] . '
' . $matches[2] . '
' . $matches[3];
},
$block_content
);
return $updated_content;
}
add_filter( 'render_block', 'wp_restore_group_inner_container', 10, 2 );