diff --git a/lib/cleanup.php b/lib/cleanup.php index 6108b5a..4555077 100644 --- a/lib/cleanup.php +++ b/lib/cleanup.php @@ -94,6 +94,17 @@ function roots_wp_title($title) { } add_filter('wp_title', 'roots_wp_title', 10); +/** + * Clean up output of stylesheet tags + */ +function roots_clean_style_tag($input) { + preg_match_all("!!", $input, $matches); + // Only display media if it is meaningful + $media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media="' . $matches[3][0] . '"' : ''; + return '' . "\n"; +} +add_filter('style_loader_tag', 'roots_clean_style_tag'); + /** * Add and remove body_class() classes */