Make WordPress Core

Changeset 55635

Timestamp:
04/08/2023 09:15:21 AM (16 months ago)
Author:
SergeyBiryukov
Message:

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.
Merges [55544] and [55547] to the 6.2 branch.
Fixes #57903.

Location:
branches/6.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.2

  • branches/6.2/src/wp-includes/blocks.php

    r55447 r55635  
    261261        wp_style_add_data( $style_handle, 'path', $style_path_norm );
    262262
    263         $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm );
     263        if ( $is_core_block ) {
     264            $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $style_path_norm );
     265        } else {
     266            $rtl_file = str_replace( '.css', '-rtl.css', $style_path_norm );
     267        }
    264268
    265269        if ( is_rtl() && file_exists( $rtl_file ) ) {
Note: See TracChangeset for help on using the changeset viewer.