diff --git a/projects/packages/jetpack-mu-wpcom/changelog/hotfix-query-loop-bug b/projects/packages/jetpack-mu-wpcom/changelog/hotfix-query-loop-bug new file mode 100644 index 0000000000000..52bf91865d6aa --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/hotfix-query-loop-bug @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Hotfix for a {Gutenberg 20.0.0, WP 6.7.x} bug causing the Content block to output truncated HTML. diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-hotfixes/wpcom-hotfixes.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-hotfixes/wpcom-hotfixes.php index 5b50ae0ea76d0..a0d6df40a2601 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-hotfixes/wpcom-hotfixes.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-hotfixes/wpcom-hotfixes.php @@ -24,3 +24,29 @@ function ( $args ) { }, 20 ); + +/** + * Hotfix for a {Gutenberg 20.0.0, WP 6.7.x} bug causing the Content block to output truncated HTML. + * See: https://github.com/WordPress/gutenberg/issues/68614 + */ +if ( + // WordPress 6.7.x contains the buggy remove_serialized_parent_block() function. + version_compare( get_bloginfo( 'version' ), '6.8', '<' ) ) { + + add_filter( + 'the_content', + function ( $content ) { + if ( has_filter( 'the_content', 'remove_serialized_parent_block' ) ) { + // We will revert the content manipulation done in https://github.com/WordPress/gutenberg/pull/67272. + + // Reverts https://github.com/WordPress/gutenberg/pull/67272/files#diff-611d9e2b5a9b00eb2fbe68d044eccb195759a422e36f525186d43d752bee3d71R65-R68 + remove_filter( 'the_content', 'remove_serialized_parent_block', 8 ); + + // Reverts https://github.com/WordPress/gutenberg/pull/67272/files#diff-611d9e2b5a9b00eb2fbe68d044eccb195759a422e36f525186d43d752bee3d71R57-R63 + return remove_serialized_parent_block( $content ); + } + return $content; + }, + 1 + ); +}