diff --git a/packages/block-library/src/gallery/index.php b/packages/block-library/src/gallery/index.php index dd7c37239f3127..1e5b21e067c66d 100644 --- a/packages/block-library/src/gallery/index.php +++ b/packages/block-library/src/gallery/index.php @@ -32,3 +32,21 @@ function render_block_core_gallery_data( $parsed_block ) { } add_filter( 'render_block_data', 'render_block_core_gallery_data' ); + +/** + * Registers the `core/gallery` block on server. + * This render callback needs to be here + * so that the gallery styles are loaded in block-based themes. + */ +function gutenberg_register_block_core_gallery() { + register_block_type_from_metadata( + __DIR__ . '/gallery', + array( + 'render_callback' => function ( $attributes, $content ) { + return $content; + }, + ) + ); +} + +add_action( 'init', 'gutenberg_register_block_core_gallery', 20 ); diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php index fc442659d5509d..4e149a9c13fcea 100644 --- a/packages/block-library/src/image/index.php +++ b/packages/block-library/src/image/index.php @@ -29,7 +29,7 @@ function render_block_core_image( $attributes, $content ) { /** - * Register image block. + * Registers the `core/image` block on server. */ function register_block_core_image() { register_block_type_from_metadata(