I just realized that this issue was already opened some time ago: https://wordpress.org/support/topic/amp-validator-fail/ .
Any update on this?
Bear in mind that for some websites AMP traffic it’s as high as 500% of their traffic.
I don’t want the script to be in the footer or the head. Just to be accessible throw http://www.exampledomain.com/sw.js, so I think I’m good with the request or WP solution.
Thanks,
With wp_enqueue_script the javascript would be included in the head of my WP page, right? That it’s something that I don’t desire.
The approach of using a add_filter over request seems nice too, but doesn’t differ much from the one I propose.
Instead of using
add_action( 'wp', 'sw_entry_point' );
I would be using
add_filter( 'request', 'sw_entry_point' );
It’s that it?