Created
November 23, 2010 13:44
-
-
Save jeremyboggs/711775 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Removes inline width and height attributes for images. Thanks to | |
* @boonebgorges and @wayne_graham for help with this! | |
*/ | |
function clioweb_remove_inline_sizes($html) { | |
$pattern = '/(\sheight|\swidth)="(.*?)"/'; | |
$html = preg_replace($pattern, '', $html); | |
return $html; | |
} | |
add_filter( 'get_image_tag', 'clioweb_remove_inline_sizes', 10, 1 ); |
In case you didn't see the notice, I smashed the regex into a single check to avoid loop check https://gist.github.com/720074
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Terrific Wayne, thanks! I was actually wondering about that. Will update the code.