From e62aeaebaaa21f1c65261cb1517079e321b3e115 Mon Sep 17 00:00:00 2001 From: Burhan Nasir Date: Tue, 28 Apr 2026 14:43:40 +0500 Subject: [PATCH] Remove mce css and script loader tag filter --- includes/functions/core.php | 55 ------------------------------------- 1 file changed, 55 deletions(-) diff --git a/includes/functions/core.php b/includes/functions/core.php index 9bc49d09..730fa26e 100644 --- a/includes/functions/core.php +++ b/includes/functions/core.php @@ -24,11 +24,6 @@ function setup() { add_action( 'init', $n( 'init' ) ); add_action( 'admin_enqueue_scripts', $n( 'admin_scripts' ) ); - // Editor styles. add_editor_style() doesn't work outside of a theme. - add_filter( 'mce_css', $n( 'mce_css' ) ); - // Hook to allow async or defer on asset loading. - add_filter( 'script_loader_tag', $n( 'script_loader_tag' ), 10, 2 ); - add_action( 'plugins_loaded', $n( 'maybe_load_features' ), 11 ); add_filter( 'ep_user_register_feature', '__return_false' ); @@ -138,56 +133,6 @@ function admin_scripts() { ); } -/** - * Enqueue editor styles. Filters the comma-delimited list of stylesheets to load in TinyMCE. - * - * @param string $stylesheets Comma-delimited list of stylesheets. - * @return string - */ -function mce_css( $stylesheets ) { - if ( ! empty( $stylesheets ) ) { - $stylesheets .= ','; - } - - return $stylesheets . ELASTICPRESS_LABS_URL . ( ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? - 'assets/css/frontend/editor-style.css' : - 'dist/css/editor-style.min.css' ); -} - -/** - * Add async/defer attributes to enqueued scripts that have the specified script_execution flag. - * - * @link https://core.trac.wordpress.org/ticket/12009 - * @param string $tag The script tag. - * @param string $handle The script handle. - * @return string - */ -function script_loader_tag( $tag, $handle ) { - $script_execution = wp_scripts()->get_data( $handle, 'script_execution' ); - - if ( ! $script_execution ) { - return $tag; - } - - if ( 'async' !== $script_execution && 'defer' !== $script_execution ) { - return $tag; - } - - // Abort adding async/defer for scripts that have this script as a dependency. _doing_it_wrong()? - foreach ( wp_scripts()->registered as $script ) { - if ( in_array( $handle, $script->deps, true ) ) { - return $tag; - } - } - - // Add the attribute if it hasn't already been added. - if ( ! preg_match( ":\s$script_execution(=|>|\s):", $tag ) ) { - $tag = preg_replace( ':(?=>):', " $script_execution", $tag, 1 ); - } - - return $tag; -} - /** * Check if minimum ElasticPress requirements are met before loading the plugin feature. */