From fe88860232a0749258e49c03532be20384d74ffd Mon Sep 17 00:00:00 2001 From: Mario Santos Date: Fri, 11 Oct 2024 14:03:48 +0200 Subject: [PATCH] Only run script if not already registered --- lib/compat/wordpress-6.7/block-bindings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.7/block-bindings.php b/lib/compat/wordpress-6.7/block-bindings.php index bde1277b66b7b0..70ba523ac966ea 100644 --- a/lib/compat/wordpress-6.7/block-bindings.php +++ b/lib/compat/wordpress-6.7/block-bindings.php @@ -19,7 +19,7 @@ function gutenberg_bootstrap_server_block_bindings_sources() { 'usesContext' => $source->uses_context, ); } - $script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) ); + $script = sprintf( 'for ( const source of %s ) { ! wp.blocks.getBlockBindingsSource( source.name ) && wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) ); wp_add_inline_script( 'wp-blocks', $script