diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index d4a0554fc0..1c1de18254 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -986,6 +986,10 @@ function block_has_support( $block_type, $feature, $default = false ) { * @return array Filtered metadata for registering a block type. */ function wp_migrate_old_typography_shape( $metadata ) { + if ( ! isset( $metadata['supports'] ) ) { + return $metadata; + } + $typography_keys = array( '__experimentalFontFamily', '__experimentalFontStyle', @@ -996,8 +1000,10 @@ function wp_migrate_old_typography_shape( $metadata ) { 'fontSize', 'lineHeight', ); + foreach ( $typography_keys as $typography_key ) { $support_for_key = _wp_array_get( $metadata['supports'], array( $typography_key ), null ); + if ( null !== $support_for_key ) { _doing_it_wrong( 'register_block_type_from_metadata()', @@ -1012,10 +1018,12 @@ function wp_migrate_old_typography_shape( $metadata ) { ), '5.8.0' ); + _wp_array_set( $metadata['supports'], array( 'typography', $typography_key ), $support_for_key ); unset( $metadata['supports'][ $typography_key ] ); } } + return $metadata; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 13d3297aaf..0065fa77da 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-beta2-51166'; +$wp_version = '5.8-beta2-51167'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.