Smush Lazyload not working in my site

It doesn't seem Lazy Loading is working. I understand it's in beta. I am a developer so I was wondering if there was any debugging I could do to figure out why?
I set the duration of fade to an obscene number and they aren't lazy loading. My theme uses wp_footer() and wp_header() as requested. Please help me to fix this.

  • Nithin
    • Support Wizard

    Hi Tyler Cooper,

    I could access your website dashboard, but the homepage is throwing the following error message:

    So wasn't able to test the issue further on your website. Could you please correct the 502 error with your hosting provider, so that we could check further regarding the Smush Lazyload issue?

    Also, is it possible for you to set up the Staging site so that we could further test to rule out any conflicts to have a better idea what's causing the feature to not work as expected?
    https://wpengine.com/support/staging-development-environments-wp-engine/

    Kind Regards,
    Nithin

  • Nithin
    • Support Wizard

    Hi Tyler Cooper,

    Thanks for sharing the credentials. I created a test page, and Lazyload does work there when tested, ie:
    https://siteURL.com/img-test/

    The img tags do seem to load the correct lazyload attributes when tested in the above-mentioned page. However, I could notice that it doesn't work the same in Homepage.

    Seems like the images are added via custom module feature which is part of the theme, and most how the images are rendered by the themes module might be causing this issue.

    I'm checking this with the developer to see whether there is anything helpful that could be done in such use case, and will get back to you once we get further feedback regarding this asap.

    Kind Regards,
    Nithin

  • Tyler Cooper
    • New Recruit

    Hey Nithin,

    Thanks for checking that. Yes, we use ACF Flexible Content to build the pages in the theme. It has .php files tied to each ACF Flexible Content "Module". If there is something I can add to the theme to help it out, or modify how images are added, let me know!

  • Nithin
    • Support Wizard

    Hi Tyler Cooper,

    We have a patch regarding this, could you please test, and see whether it helps regarding how the images are looked upon?

    You'll have to replace the patch file in the following path:
    /wp-content/plugins/wp-smush-pro/core/modules/class-wp-smush-lazy-load.php

    This patch will be made available in version 3.3, please do check, and see how it goes. Have a nice day ahead.

    Regards,
    Nithin

  • Tyler Cooper
    • New Recruit

    When I replaced that file, it caused some errors. Here is what debug.log gave me.

    [18-Jul-2019 14:36:53 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function WP_Smush_Lazy_Load::__construct(), 0 passed in /nas/content/live/swstaginglive/wp-content/plugins/wp-smush-pro/core/class-wp-smush-modules.php on line 97 and exactly 1 expected in /nas/content/live/swstaginglive/wp-content/plugins/wp-smush-pro/core/modules/class-wp-smush-lazy-load.php:40
    Stack trace:
    #0 /nas/content/live/swstaginglive/wp-content/plugins/wp-smush-pro/core/class-wp-smush-modules.php(97): WP_Smush_Lazy_Load->__construct()
    #1 /nas/content/live/swstaginglive/wp-content/plugins/wp-smush-pro/core/class-wp-smush-core.php(311): WP_Smush_Modules->__construct()
    #2 /nas/content/live/swstaginglive/wp-content/plugins/wp-smush-pro/core/class-wp-smush-core.php(213): WP_Smush_Core->init()
    #3 /nas/content/live/swstaginglive/wp-content/plugins/wp-smush-pro/wp-smush.php(283): WP_Smush_Core->__construct()
    #4 /nas/content/live/swstaginglive/wp-content/plugins/wp-smush-pro/wp-smush.php(209): WP_Smush->init()
    #5 /nas/content/live/swstaginglive/wp-content/plu in /nas/content/live/swstaginglive/wp-content/plugins/wp-smush-pro/core/modules/class-wp-smush-lazy-load.php on line 40

  • Nithin
    • Support Wizard

    Hi Tyler Cooper,

    It seems like you are testing the patch with Smush v 3.2.1? I'm afraid, the patch will only work with the latest release, seems like the plugin hasn't been updated yet.

    Could you please confirm whether you are testing in the latest version? If not, update the plugin to latest version ie v 3.2.2, and then apply the mentioned patch, and see how it goes?

    Looking forward to your response. Have a nice day ahead.

    Best Regards,
    Nithin

  • Tyler Cooper
    • New Recruit

    Nithin - Thanks! I updated and implemented the new file on staging and it looks like some of them are working now. SVG files still load instantly, and I can't tell if some of the other images are close enough to the fold that it's loading them, or if they are not properly lazy loading. Any reason the SVGs aren't lazy-loading? This is progress for sure!

    Ex) <img class="story_image" src="https://swstaginglive.wpengine.com/wp-content/uploads/2019/06/ofx-photo-2-e1562341786688.jpg" alt=""> on the home page https://swstaginglive.wpengine.com/ doesn't have the lazyload attributes that the other items that are lazy-loading properly have.

  • Nithin
    • Support Wizard

    Hi Tyler Cooper,

    An SVG image isn't out of the box supported media type in WordPress due to security concerns, so there hasn't many tests done in specific regarding SVG images in Smush. However, I gave a quick test, and it seems to lazyload SVG images when tested in my local server. However, Smush CDN won't work for SVG images and will skip such images to be loaded via CDN.

    Along with SVG images, I could still notice jpg images aren't lazyloaded too. I'm bringing these anomalies noticed within the developers to see what further could be done.

    Will keep you posted once I get further feedback regarding this asap.

    Regards,
    Nithin

  • Nithin
    • Support Wizard

    Hi Tyler Cooper,

    We would like to check further regarding the anomalies noticed. Could you also share the SFTP login for the staging website? It seems like you have only shared the new staging WP admin login via the contact form. If you could also share the SFTP login it would be helpful troubleshooting this further.

    You can send credentials by using our secure contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    - To Mark to my attention, the subject line should contain only: ATTN: Nithin Ramdas
    -SFTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant URLs

    Please do follow up on the ticket once you have sent the above credentials. Have a nice day. :slight_smile:

    Kind Regards,
    Nithin

  • Nithin
    • Support Wizard

    Hi Tyler Cooper,

    Sorry for the delay in getting back to you. We did apply some fixes in the Smush plugin side. However, when I try to access the WP admin dashboard of the staging.

    I'm getting the following error message:

    ERROR: Invalid username. Lost your password?
    3 login attempts remaining

    Could you please clear the caches enabled in WP Engine side, and disable, and re-activate WP Smush Lazyload feature, and then check whether it works fine?

    If you still notice anomalies, please make sure to enable support access to your website so that we could give a closer look in the dashboard side.

    You can grant access from WPMU DEV > Support > Support Access > Grant Access, or check this manual: https://premium.wpmudev.org/docs/getting-started/getting-support/#chapter-5

    Please let us know once you enable access so that we could check further if needed.

    Kind Regards,
    Nithin

    Kind Regards,
    Nithin

  • Nithin
    • Support Wizard

    Hi Tyler Cooper,

    No worries. Thanks for sending in the login credentials. On further testing, could notice some improvements but still, there are images where Lazyloading should have worked fine but it isn't working as expected when tested with the new patch.

    I'm bringing the test performed, and observations noticed into our developer's attention once again and will get back to you once we get further feedback asap.

    We truly appreciate your patience regarding this. Have a nice day ahead.

    Best Regards,
    Nithin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.