Wordpress - How do you remove hard coded thumbnail image dimensions?
Related: Filter to remove image dimension attributes?
There's a filter on post_thumbnail_html
which receives as its argument the full html element representing the post thumbnail image before it's echoed to the page. You can filter out the dimensions with a bit of regex:
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;
}
you could just grab the url of the thumb and put it in an img tag yourself:
<?php
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'your_thumb_handle' );
?>
<img src="<?php echo $thumbnail['0']; ?>" />