looks like a bug, can you open up wp-content/plugins/autoptimize/classes/autoptimizeExtra.php and on (around) line 366 change
// extract img tags.
if ( preg_match_all( '#<img[^>]*src[^>]*>#Usmi', $in, $matches ) ) {
foreach ( $matches[0] as $tag ) {
$orig_tag = $tag;
// first do (data-)srcsets.
into:
// extract img tags.
if ( preg_match_all( '#<img[^>]*src[^>]*>#Usmi', $in, $matches ) ) {
foreach ( $matches[0] as $tag ) {
$orig_tag = $tag;
$imgopt_w = '';
$imgopt_h = '';
// first do (data-)srcsets.
and then on (around) line 390 change
// proceed with img src.
// first get width and height and add to $imgopt_size.
if ( preg_match( '#width=("|\')(.*)("|\')#Usmi', $tag, $width ) ) {
into
// proceed with img src.
// first get width and height and add to $imgopt_size.
$imgopt_w = '';
$imgopt_h = '';
if ( preg_match( '#width=("|\')(.*)("|\')#Usmi', $tag, $width ) ) {
And test if that change fixes things?
frank
super, this will be in 2.4.1, out hopefully later this week. thanks for the help Amir!
Pleasure, thank you for the great work!
Have a good week