Make WordPress Core


Ignore:
Timestamp:
02/20/2023 09:11:57 PM (22 months 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/script-loader.php

    r55314 r55368  
    16361636    }
    16371637
    1638     if ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 ) {
    1639         // Include opinionated block styles if no $editor_styles are declared, so the editor never appears broken.
     1638    if (
     1639        current_theme_supports( 'wp-block-styles' ) &&
     1640        ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 )
     1641    ) {
     1642        /*
     1643         * Include opinionated block styles if the theme supports block styles and
     1644         * no $editor_styles are declared, so the editor never appears broken.
     1645         */
    16401646        $wp_edit_blocks_dependencies[] = 'wp-block-library-theme';
    16411647    }
Note: See TracChangeset for help on using the changeset viewer.