--- a/wp/wp-admin/widgets-form-blocks.php Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-admin/widgets-form-blocks.php Fri Sep 05 18:52:52 2025 +0200
@@ -51,6 +51,24 @@
'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
);
+// Preload server-registered block bindings sources.
+$registered_sources = get_all_registered_block_bindings_sources();
+if ( ! empty( $registered_sources ) ) {
+ $filtered_sources = array();
+ foreach ( $registered_sources as $source ) {
+ $filtered_sources[] = array(
+ 'name' => $source->name,
+ 'label' => $source->label,
+ 'usesContext' => $source->uses_context,
+ );
+ }
+ $script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) );
+ wp_add_inline_script(
+ 'wp-blocks',
+ $script
+ );
+}
+
wp_add_inline_script(
'wp-blocks',
sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),