Skip to content

Commit

Permalink
Only run script if not already registered
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Oct 11, 2024
1 parent e81d827 commit fe88860
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.7/block-bindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fe88860

Please sign in to comment.