I need to do disable an speed optimization plugin when the page/post is AMP. Its developer suggested to use is_amp_endpoint() to detect if AMP is running but I can’t find the right place/time where to use it.
If I check it too early using if (function_exists(‘is_amp_endpoint’) && is_amp_endpoint()), it gives a 500 error. If I check it within the AMP plugin code, it works but the optimization plugin has already run so it’s too late.
How can I figure out where to run this check so that it happens after is_amp_endpoint() works but before the optimization execution?
Read more here:: Timing issue with is_amp_endpoint()