Skip to content

Commit d570c87

Browse files
Update block parent handling for WP 6.8 compatibility (devgeniem#133)
1 parent b5af43a commit d570c87

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Block.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,11 +576,16 @@ protected function register_block() {
576576
'align' => $this->get_align(),
577577
'supports' => $this->get_supports(),
578578
'styles' => $this->get_styles(),
579-
'parent' => $this->get_parent(),
580579
];
581580

582-
if ( ! empty( $this->get_post_types() ) ) {
583-
$args['post_types'] = $this->get_post_types();
581+
$parent = $this->get_parent();
582+
if ( ! empty( $parent ) ) {
583+
$args['parent'] = $parent;
584+
}
585+
586+
$post_types = $this->get_post_types();
587+
if ( ! empty( $post_types ) ) {
588+
$args['post_types'] = $post_types;
584589
}
585590

586591
// Register the ACF Block.
@@ -614,4 +619,4 @@ protected function render( array $block = [], string $content = '', $is_preview
614619
]
615620
);
616621
}
617-
}
622+
}

0 commit comments

Comments
 (0)