Make WordPress Core

Changeset 49104


Ignore:
Timestamp:
10/08/2020 03:34:31 AM (6 years ago)
Author:
noisysocks
Message:

Tests: Fix dependency tests

Fixes test_block_styles_for_editing_with_theme_support and
test_block_styles_for_viewing_with_theme_support by partially reverting [49102]
and only calling wp_should_load_block_editor_scripts_and_styles() when on an
admin screen.

Props TimothyBlynJacobs.
See #51330.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r49102 r49104  
    21862186 */
    21872187function wp_common_block_scripts_and_styles() {
    2188         if ( ! wp_should_load_block_editor_scripts_and_styles() ) {
     2188        if ( is_admin() && ! wp_should_load_block_editor_scripts_and_styles() ) {
    21892189                return;
    21902190        }
     
    22202220        global $current_screen;
    22212221
    2222         if ( ! is_admin() ) {
    2223                 return false;
    2224         }
    2225 
    22262222        $is_block_editor_screen = ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor();
    22272223
    22282224        /**
    22292225         * Filters the flag that decides whether or not block editor scripts and
    2230          * styles are going to be enqueued on the current admin screen.
     2226         * styles are going to be enqueued on the current screen.
    22312227         *
    22322228         * @since 5.6.0
     
    22482244        global $current_screen;
    22492245
    2250         $load_editor_scripts = wp_should_load_block_editor_scripts_and_styles();
     2246        $load_editor_scripts = is_admin() && wp_should_load_block_editor_scripts_and_styles();
    22512247
    22522248        $block_registry = WP_Block_Type_Registry::get_instance();
Note: See TracChangeset for help on using the changeset viewer.