Last active
December 26, 2015 12:49
-
-
Save 2ndkauboy/7154341 to your computer and use it in GitHub Desktop.
Removes the id attribute from style tags, enabling mod_pagespeed to combine those files
This file contains 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 | |
/* | |
Plugin Name: Pagespeed CSS Combination Fix | |
Plugin URI: https://gist.github.com/2ndkauboy/7154341 | |
Description: Removes the id attribute from style tags, enabling mod_pagespeed to combine those files | |
Version: 0.1 | |
Author: Bernhard Kau | |
Author URI: http://kau-boys.de | |
*/ | |
function remove_id_form_pagespeed_optimization( $style_tag ){ | |
if ( !is_admin() ) { | |
$style_tag = preg_replace( "/id='.*-css'\s?/", '', $style_tag ); | |
} | |
return $style_tag; | |
} | |
add_filter( 'style_loader_tag', 'remove_id_form_pagespeed_optimization' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment