Skip to content

Instantly share code, notes, and snippets.

@waynegraham
Forked from jeremyboggs/wp-remove-inline-image-sizes.php
Created November 29, 2010 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waynegraham/720074 to your computer and use it in GitHub Desktop.
Save waynegraham/720074 to your computer and use it in GitHub Desktop.
/**
* Removes inline width and height attributes for images. Thanks to
* @boonebgorges 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 );
@jeremyboggs
Copy link

Hot. I so need to learn regex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment