_very_ weird devaceza; AO is not supposed to be active an AMP-pages. can you share your URL here or via futtta-at-gmail-dot-com?
frank
Hi Frank
I sent to your email the URL, can you confirm please that you received it?
Thanks
Regards,
Aaron
OK, the problem is that AO currently bails when it encounters
<html amp
or
<html ⚡
while you have
<html dir="ltr" amp>
Which is correct for amp but AO just doesn’t recognize it as an AMP-page.
Give me a second, I’ll be back with a workaround soon (and will fix for the next AO-version).
Oh, question; which plugin are you using to have AMP-pages?
frank
I am using the WPtouch Pro plugin using the AMP extension provided by that plugin.
http://www.wptouch.com/extensions/amp//
Regards,
Aaron
ok, use this as a workaround;
add_filter('autoptimize_filter_noptimize','amp_workaround');
function amp_workaround($in) {
if (strpos($_SERVER['REQUEST_URI'],'/amp/')!==false) {
return true;
} else {
return false;
}
}
you can add this using the code snippets plugin or in your child theme’s functions.php if you insist 😉
frank
Hi Frank,
I inserted your code on my child theme’s functions.php and it works!
Thank you so much Frank.
Nice. I should be back with a more fundamental solution later today, would be great if you could test that.
frank
OK, so the more fundamental fix is in the development-version of Autoptimize, you can see it in this GitHub commit.
It would be great if you could test this on your site (after having disabled the code you just added to your functions.php) by either making the (small) change in wp-content/plugins/autoptimize/autoptimize.php or by downloading the zip-file from GitHub and overwriting your wp-content/plugins/autoptimize folder with the contents of the autoptimize-master folder of the zipfile.
frank