Created
September 9, 2013 01:29
-
-
Save Boztown/6490330 to your computer and use it in GitHub Desktop.
Remove hard-coded width/height from image thumbnails in Wordpress.
This file contains hidden or 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
// remove hard-coded width/height | |
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10, 3 ); | |
function remove_thumbnail_dimensions( $html, $post_id, $post_image_id ) { | |
$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