Created
September 19, 2016 15:32
-
-
Save isaumya/f4195f372352959704b6985cb3285a64 to your computer and use it in GitHub Desktop.
Fix: CSS minification & combination is not working for WordPress sites with mod_pagespeed or ngx_pagespeed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*Allowing mod_pagespeed or nginx_pagespeed to combine CSS files*/ | |
/*By removing the ID field from the css link href*/ | |
add_filter('style_loader_tag', function( $link ) { | |
// Removing the Style ID from the WordPress CSS output as the ID in `link` causes the issue | |
return preg_replace("/id='.*-css'/", "", $link); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment