IE8 WordPress Thumbnails > add px to $hwstring

WordPress renders thumbnails with these attributes:

<img width="100" height="200" ... 

IE78 requires is this:

Read More
<img width="100px" height="200px" ... 

(exact problem is here: WordPress featured images not showing up in IE8)

I digged into the core and found the code where the heightwidth is rendered:
http://core.trac.wordpress.org/browser/trunk/wp-includes/media.php#L223

my question:
Can you please help me with a custom function to add the px part into the $hwstring (function is here: http://core.trac.wordpress.org/browser/trunk/wp-includes/media.php#L98 )

thanks in advance for every tip.

Related posts

Leave a Reply

1 comment

  1. Try this;

    function custom_dimensions($html, $id, $alt, $title, $align, $size){
        $html = preg_replace('%(width|height)(="[0-9]{1,4})(")%', '$1$2px$3', $html);
        return $html;
    }
    
    add_filter('get_image_tag', 'custom_dimensions',1, 6);
    

    I’ve only quickly tested it out at my end.