How to remove all enqueued assets from the active theme?
Here you go. I took this out of my mailoptin plugin. Adapt the code to your use case. add_action(‘wp_enqueue_scripts’, function () use ($wp_get_theme) { global $wp_styles; global $wp_scripts; $wp_get_theme = wp_get_theme(); $child_theme = $wp_get_theme->get_stylesheet(); $parent_theme = $wp_get_theme->get_template(); foreach ($wp_scripts->registered as $key => $value) { $src = $value->src; if (strpos($src, “themes/$child_theme/”) !== false || strpos($src, “themes/$parent_theme/”) … Read more