Skip to content

Instantly share code, notes, and snippets.

@isaumya
Created September 19, 2016 15:32
Show Gist options
  • Save isaumya/f4195f372352959704b6985cb3285a64 to your computer and use it in GitHub Desktop.
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
<?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