Skip to content

Instantly share code, notes, and snippets.

@iscat
Created May 18, 2013 14:37
Show Gist options
  • Save iscat/5604618 to your computer and use it in GitHub Desktop.
Save iscat/5604618 to your computer and use it in GitHub Desktop.
<?php
/* Remove the width and height attributes from wp image uploader.
http://blog.wpjam.com/m/how-to-remove-the-width-and-height-attributes-from-wp-image-uploader/
------------------------------------------------------------------------------------------ */
add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );
function remove_width_attribute( $html ) {
$html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
return $html;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment