diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php
index 1dc1e66230..110737bdb3 100644
a
|
b
|
function register_block_style_handle( $metadata, $field_name, $index = 0 ) { |
258 | 258 | } |
259 | 259 | // Return the style handle unless it's the first item for every core block that requires special treatment. |
260 | 260 | if ( $is_style_handle && ! ( $is_core_block && 0 === $index ) ) { |
| 261 | // Current solution with initial `array_unshift` is broken due hardcode of 0 index ($is_core_block && 0 === $index), so it returns incorrect name |
| 262 | // AFAIU we always expect to have first styles as a custom styles (theme.json) |
261 | 263 | return $style_handle; |
262 | 264 | } |
263 | 265 | |
… |
… |
function register_block_type_from_metadata( $file_or_folder, $args = array() ) { |
397 | 399 | if ( current_theme_supports( 'wp-block-styles' ) && wp_should_load_separate_core_block_assets() ) { |
398 | 400 | $metadata['style'] = (array) $metadata['style']; |
399 | 401 | $metadata['style'][] = "wp-block-{$block_name}-theme"; |
| 402 | |
| 403 | // we should put "wp-block-{$block_name}-theme" before styles from theme.json and any other styles, |
| 404 | // since these styles are default, so we should have opportunity to override it |
| 405 | array_unshift( $metadata['style'], "wp-block-{$block_name}-theme" ); |
400 | 406 | } |
401 | 407 | if ( ! isset( $metadata['editorStyle'] ) ) { |
402 | 408 | $metadata['editorStyle'] = "wp-block-{$block_name}-editor"; |