Skip to main content
1 of 2
murcoder
  • 99
  • 1
  • 1
  • 13

Remove style tags from head

is there a filter for removing style-tags from the <head></head> area in wordpress?

I already achieved to remove link-tags by using this wordpress filter and some regex:

add_filter( 'style_loader_tag', 'removeGoogleLinks');

But how to remove style tags like that one:

<head>
     <style>
        @import url('https://fonts.googleapis.com/css?family=Chilanka&display=swap');
    </style>
</head>

I guess i havbe to use wp_head somehow but how to use this?

add_filter( 'wp_head',  $removeGoogleFontStyle); 

public function removeGoogleFontStyle($content){
   //Filter googleapi styles with regex but
   //how to use this funtion/filter?
} 
murcoder
  • 99
  • 1
  • 1
  • 13