Hey @anoirinoh!
Thanks for posting this issue.
I’ll do some testing with the amp plugin. Are you using the “official” AMP plugin or the AMP for WP plugin?
My initial thought is that Scripts to footer shouldn’t run on amp endpoints at all, since you’ll be handling scripts so differently in those conditions.
Thanks,
Joshua
Hi @joshuadnelson
Thank you for the quick reply, I am using the official AMP plugin, yeah, I think we should exclude script to footer plugin from running on AMP pages, I have found a similar fix for litespeed cache, I think code like this:
function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() && ! defined( 'LITESPEED_NO_LAZY' ) && define( 'LITESPEED_NO_LAZY', true ) ;
could fix the issue but I don’t know the variables I should replace.
Thanks
Yea, great! I’ll work on a change and try to have an update out soon.
In the meantime, the main stf_include filter should work:
function stf_amp_filter( $include ) {
if( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() )
$include = false;
return $include;
}
add_filter( 'stf_include', 'stf_amp_filter' );
Hi there,
Thank you for your reply and sorry for the late response. I tried the code you cited above without any results and still getting the issue, any alternative solution?
Hey again!
Sorry that didn’t work for you! I’m on vacation at the moment, but I’ll test this out a bit more and get a solution for you (either a plugin update or custom code) next week.
Thanks,
Joshua
Hey @anoirinoh – apologies on my delay here. Can you confirm if this is still an issue for you in the current versions of AMP (1.4.2) and Scripts To Footer (0.6.4)? I’ve tried to replicate this issue, but AMP is working as expected on my end.
It could be related to a specific configuration, though. Are you using the “Standard, “Traditional,” or “Reader” website mode? (Setting in AMP > General)