This is pretty simple to filter a specific css file's link. But I want to filter all except style.css using: add_filter( 'style_loader_tag', 'remove_https_http', 10, 4 );
recursively to deliver optimized css and high score on page speed and load time.
add_filter( 'style_loader_tag', 'remove_https_http', 10, 4 );
function remove_https_styles( $html, $handle, $href, $media ){
$handles = array('twentysixteen-fonts', 'open-sans');
if( in_array( $handle, $handles ) ){
$html = str_replace('https:', '', $html);
}
return $html;
}
This will be great if there is others approach. I already study on: CSS delivery optimization: How to defer css loading?. But it seems to me filtering all css links which can be loaded after rendering my page, suggested by : https://developers.google.com/web/fundamentals/performance/critical-rendering-path/render-blocking-css.
Any idea will be a great tool tip. Thanks in advance.