From dc67681b44a0712a4aeb2a72e0e845c1610373ae Mon Sep 17 00:00:00 2001 From: Nelson Amaya Date: Sun, 13 Oct 2024 16:47:25 -0500 Subject: [PATCH] This PR addresses issue #1200 --- Core/Providers/AssetsProvider.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Core/Providers/AssetsProvider.php b/Core/Providers/AssetsProvider.php index bd183535..0ecb09f6 100644 --- a/Core/Providers/AssetsProvider.php +++ b/Core/Providers/AssetsProvider.php @@ -390,13 +390,17 @@ public function enqueue_block_editor_assets() { foreach ( $scripts as $script_handle => $script_file ) { $build_vars = require \PF_ROOT . '/build/' . $script_file . '.asset.php'; - wp_enqueue_script( - $script_handle, - \PF_URL . '/build/' . $script_file . '.js', - $build_vars['dependencies'], - $build_vars['version'], - true - ); + // Avoid enqueuing scripts/styles on the widgets page. + $current_screen = get_current_screen(); + if ( $current_screen->id !== 'widgets' ) { + wp_enqueue_script( + $script_handle, + \PF_URL . '/build/' . $script_file . '.js', + $build_vars['dependencies'], + $build_vars['version'], + true + ); + } } wp_add_inline_script(