diff --git a/lib/compat/wordpress-6.5/interactivity-api/interactivity-api.php b/lib/compat/wordpress-6.5/interactivity-api/interactivity-api.php index e532fe24447132..c4c0ac37519f41 100644 --- a/lib/compat/wordpress-6.5/interactivity-api/interactivity-api.php +++ b/lib/compat/wordpress-6.5/interactivity-api/interactivity-api.php @@ -58,16 +58,20 @@ function wp_interactivity_process_directives_of_interactive_blocks( array $parse }; /* - * Uses a priority of 20 to ensure that other filters can add additional - * directives before the processing starts. - */ - add_filter( 'render_block_' . $block_name, $process_interactive_blocks, 20, 2 ); + * Uses a priority of 100 to ensure that other filters can add additional + * directives before the processing starts. + */ + add_filter( 'render_block_' . $block_name, $process_interactive_blocks, 100, 2 ); } } return $parsed_block; } - add_filter( 'render_block_data', 'wp_interactivity_process_directives_of_interactive_blocks' ); + /* + * Uses a priority of 100 to ensure that other filters can edit $parsed_block + * without crashing the SSR. + */ + add_filter( 'render_block_data', 'wp_interactivity_process_directives_of_interactive_blocks', 100, 1 ); } if ( ! function_exists( 'wp_interactivity' ) ) { diff --git a/packages/e2e-tests/plugins/interactive-blocks.php b/packages/e2e-tests/plugins/interactive-blocks.php index 0d35cc827d6da3..ab2f85156e3b3e 100644 --- a/packages/e2e-tests/plugins/interactive-blocks.php +++ b/packages/e2e-tests/plugins/interactive-blocks.php @@ -31,7 +31,8 @@ function () { // But remove the server directive processing. remove_filter( 'render_block_data', - 'wp_interactivity_process_directives_of_interactive_blocks' + 'wp_interactivity_process_directives_of_interactive_blocks', + 100 ); } }