From 74ca5659a221c47c0dc684f1a2890f438ba32c33 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 14 Mar 2023 16:00:19 +0000 Subject: [PATCH] Editor: Correctly load RTL stylesheets for non-core blocks. If `SCRIPT_DEBUG` is disabled, `register_block_style_handle()` loads core blocks' styles with the `.min` suffix, while non-core ones never use the minified files, but the suffix was still mistakenly included in the `-rtl` file lookup. This commit updates the logic to match the style path set earlier in the function, ensuring that RTL stylesheets are loaded properly for both core and non-core blocks, with or without `SCRIPT_DEBUG`. Follow-up to [49982], [50836], [54330], [55486]. Props david.binda. Fixes #57903. Built from https://develop.svn.wordpress.org/trunk@55544 git-svn-id: http://core.svn.wordpress.org/trunk@55056 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 9a8c3b06f4..787ba44d2c 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -260,7 +260,11 @@ function register_block_style_handle( $metadata, $field_name, $index = 0 ) { if ( $has_style_file ) { wp_style_add_data( $style_handle, 'path', $style_path_norm ); - $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm ); + if ( $is_core_block ) { + $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm ); + } else { + $rtl_file = str_replace( ".css", "-rtl.css", $style_path_norm ); + } if ( is_rtl() && file_exists( $rtl_file ) ) { wp_style_add_data( $style_handle, 'rtl', 'replace' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 3c8e2b7992..a71efd881f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55543'; +$wp_version = '6.3-alpha-55544'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.