Skip to content

Commit c418227

Browse files
authored
Fix – Blocks registered via acf_register_block_type() with a parent value of null no longer fail to register (#181)
1 parent dd58204 commit c418227

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

includes/blocks.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,16 @@ function acf_validate_block_type( $block ) {
414414
$block['supports']['jsx'] = $block['supports']['__experimental_jsx'];
415415
}
416416

417+
// Normalize block 'parent' setting.
418+
if ( array_key_exists( 'parent', $block ) ) {
419+
// As of WP 6.8, parent must be an array.
420+
if ( null === $block['parent'] ) {
421+
unset( $block['parent'] );
422+
} elseif ( is_string( $block['parent'] ) ) {
423+
$block['parent'] = array( $block['parent'] );
424+
}
425+
}
426+
417427
// Return block.
418428
return $block;
419429
}

0 commit comments

Comments
 (0)