From 089d6d750f4bf210ce99c2bf9a7e7711b06edb15 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Fri, 15 Sep 2023 12:22:30 +1000 Subject: [PATCH 1/3] Fix layout when post content is root block --- lib/compat/wordpress-6.3/block-editor-settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.3/block-editor-settings.php b/lib/compat/wordpress-6.3/block-editor-settings.php index 59f46d7edb9890..812804d87a7db8 100644 --- a/lib/compat/wordpress-6.3/block-editor-settings.php +++ b/lib/compat/wordpress-6.3/block-editor-settings.php @@ -78,7 +78,7 @@ function gutenberg_get_block_editor_settings_experimental( $settings ) { $template_blocks = parse_blocks( $current_template[0]->content ); $post_content_block = gutenberg_find_first_block( 'core/post-content', $template_blocks ); - if ( ! empty( $post_content_block['attrs'] ) ) { + if ( is_array( $post_content_block['attrs'] ) || is_object( $post_content_block['attrs'] ) ) { $settings['postContentAttributes'] = $post_content_block['attrs']; } } From 3a7dd72f6f80192114a49736f7322df7eb6f9723 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Fri, 15 Sep 2023 14:35:03 +1000 Subject: [PATCH 2/3] Change check to isset --- lib/compat/wordpress-6.3/block-editor-settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.3/block-editor-settings.php b/lib/compat/wordpress-6.3/block-editor-settings.php index 812804d87a7db8..c3a217c77658c9 100644 --- a/lib/compat/wordpress-6.3/block-editor-settings.php +++ b/lib/compat/wordpress-6.3/block-editor-settings.php @@ -78,7 +78,7 @@ function gutenberg_get_block_editor_settings_experimental( $settings ) { $template_blocks = parse_blocks( $current_template[0]->content ); $post_content_block = gutenberg_find_first_block( 'core/post-content', $template_blocks ); - if ( is_array( $post_content_block['attrs'] ) || is_object( $post_content_block['attrs'] ) ) { + if ( isset( $post_content_block['attrs'] ) ) { $settings['postContentAttributes'] = $post_content_block['attrs']; } } From 5871a64afe1ff669816102f82e8486fd21412709 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Fri, 15 Sep 2023 14:50:05 +1000 Subject: [PATCH 3/3] Update lib/compat/wordpress-6.3/block-editor-settings.php Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> --- lib/compat/wordpress-6.3/block-editor-settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.3/block-editor-settings.php b/lib/compat/wordpress-6.3/block-editor-settings.php index c3a217c77658c9..b478d022c16dd9 100644 --- a/lib/compat/wordpress-6.3/block-editor-settings.php +++ b/lib/compat/wordpress-6.3/block-editor-settings.php @@ -78,7 +78,7 @@ function gutenberg_get_block_editor_settings_experimental( $settings ) { $template_blocks = parse_blocks( $current_template[0]->content ); $post_content_block = gutenberg_find_first_block( 'core/post-content', $template_blocks ); - if ( isset( $post_content_block['attrs'] ) ) { + if ( isset( $post_content_block['attrs'] ) ) { $settings['postContentAttributes'] = $post_content_block['attrs']; } }