From fe1fd2a3ced78136797ce5d04aaceb670c388fa7 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Wed, 27 Jul 2022 15:34:37 +0200 Subject: [PATCH] Comments Block (legacy): Don't render empty block wrapper --- packages/block-library/src/comments/index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/block-library/src/comments/index.php b/packages/block-library/src/comments/index.php index 5df2ed550a21e..ef8c98e3910a0 100644 --- a/packages/block-library/src/comments/index.php +++ b/packages/block-library/src/comments/index.php @@ -62,6 +62,10 @@ function render_block_core_comments( $attributes, $content, $block ) { $output = ob_get_clean(); $post = $post_before; + if ( empty( $output ) ) { + return ''; + } + $classnames = array(); // Adds the old class name for styles' backwards compatibility. if ( isset( $attributes['legacy'] ) ) {