diff --git a/src/wp-includes/block-editor.php b/src/wp-includes/block-editor.php index c177d9619d..1c67e6cc7a 100644 --- a/src/wp-includes/block-editor.php +++ b/src/wp-includes/block-editor.php @@ -192,12 +192,17 @@ function get_default_block_editor_settings() { // These styles are used if the "no theme styles" options is triggered or on // themes without their own editor styles. $default_editor_styles_file = ABSPATH . WPINC . '/css/dist/block-editor/default-editor-styles.css'; - if ( file_exists( $default_editor_styles_file ) ) { + + static $default_editor_styles_file_contents = false; + if ( ! $default_editor_styles_file_contents && file_exists( $default_editor_styles_file ) ) { + $default_editor_styles_file_contents = file_get_contents( $default_editor_styles_file ); + } + + $default_editor_styles = array(); + if ( $default_editor_styles_file_contents ) { $default_editor_styles = array( - array( 'css' => file_get_contents( $default_editor_styles_file ) ), + array( 'css' => $default_editor_styles_file_contents ), ); - } else { - $default_editor_styles = array(); } $editor_settings = array(