Lazy load does not work with AMP. Solution
-
The plugin is lightweight and works well for desktop and the full mobile version of my site: https://casinoivan.com
I am also using the “AMP for WordPress” plugin for my AMP version of my site:https://casinoivan.com/?amp
However, I noticed that the images are not shown on the AMP pages.Luckily I have found the problem. I have excluded “Lazy load” from the AMP pages by modifying the plugin.
In the lazy-load-for-images.php file I have canceled the deferred load script registration if it is in AMP. I have added this code: is_amp_endpoint ()
// * Don’t Lazy Load
if (is_admin () || is_amp_endpoint () || is_preview () || is_feed () || (defined (‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) || (defined (‘DOING_CRON’) && DOING_CRON) || (defined (‘ DOING_AJAX ‘) && DOING_AJAX) || (defined (‘ XMLRPC_REQUEST ‘) && XMLRPC_REQUEST)) {
return;
}
- The topic ‘Lazy load does not work with AMP. Solution’ is closed to new replies.