Best way to disable function in a plugin? (Soil)

I was going through this excelent guide on Async CSS loading in Sage, and found that the async loading snippet clashed with Soil’s clean_style_tag function as it removes ids from style tags.

Solved it by disabling add_theme_support('soil-clean-up'), but I really need to disable just the clean_style_tag feature of the script.

Is there a safe and futureproof way to disable this (or any other) particular function in a plugin? I’m using the Trellis/Bedrock/Sage stack, so plugins are managed by composer.

What about removing the filter? Put this line in the filters.php file in Sage

remove_filter('style_loader_tag', '\Roots\Soil\CleanUp\clean_style_tag');

2 Likes