Make WordPress Core


Ignore:
Timestamp:
02/20/2023 09:11:57 PM (2 years ago)
Author:
hellofromTonya
Message:

Editor: Fix 'wp-block-library-theme' style enqueue conditions.

Fixes the conditions for when to enqueue the opinionated block styles (i.e. 'wp-block-library-theme' stylesheet):

  • the theme adds 'wp-block-styles' theme support;
  • and no editor styles are declared.

This resolves an issue with themes that do not add the 'wp-block-styles' theme support while not impacting themes that do.

Follow-up to [53419], [52069], [50761], [44157].

Props mikachan, costdev, glendaviesnz, hellofromTonya, jffng, mamaduka, ndiego, poena, sannevndrmeulen, scruffian.
Fixes #57561.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-editor.php

    r55192 r55368  
    297297 */
    298298function _wp_get_iframed_editor_assets() {
    299     global $pagenow;
     299    global $pagenow, $editor_styles;
    300300
    301301    $script_handles = array(
     
    306306    );
    307307
    308     if ( current_theme_supports( 'wp-block-styles' ) ) {
     308    if (
     309        current_theme_supports( 'wp-block-styles' ) &&
     310        ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 )
     311    ) {
    309312        $style_handles[] = 'wp-block-library-theme';
    310313    }
Note: See TracChangeset for help on using the changeset viewer.