From 601ae4a6b21746d3c53e8d718c955c14a50d7bb2 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Wed, 4 Aug 2021 05:09:08 +0000 Subject: [PATCH] Editor: Prevent block-editor JavaScript loading in other editors. Add a check to `wp_add_iframed_editor_assets_html()` confirming the edit post screen is using the block-editor before including block-editor specific JavaScript. For the classic and other editors the function returns early without any output. Props swissspidy, desrosj. Fixes #53696. git-svn-id: https://develop.svn.wordpress.org/trunk@51540 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/script-loader.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index e4ec2088f0..3f685da67a 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -2732,6 +2732,10 @@ function wp_maybe_inline_styles() { * @since 5.8.0 */ function wp_add_iframed_editor_assets_html() { + if ( ! wp_should_load_block_editor_scripts_and_styles() ) { + return; + } + $script_handles = array(); $style_handles = array( 'wp-block-editor',