{"id":197385,"date":"2025-01-11T05:05:56","date_gmt":"2025-01-11T05:05:56","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/lazy-load-fix-for-divi\/"},"modified":"2025-12-20T21:03:39","modified_gmt":"2025-12-20T21:03:39","slug":"lazy-load-fix-for-divi","status":"publish","type":"plugin","link":"https:\/\/pcd.wordpress.org\/plugins\/lazy-load-fix-for-divi\/","author":16091062,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.1.1","stable_tag":"1.1.1","tested":"6.9.4","requires":"5.7.0","requires_php":"7.0","requires_plugins":null,"header_name":"Lazy Load Fix For Divi","header_author":"Jerry Stewart","header_description":"Offers precise control of the ATF\/BTF threshold to control the lazy loading of images","assets_banners_color":"","last_updated":"2025-12-20 21:03:39","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"https:\/\/webworkz.nz","rating":0,"author_block_rating":0,"active_installs":30,"downloads":671,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.1.0":{"tag":"1.1.0","author":"jerrystewart99","date":"2025-01-14 02:48:46"},"1.1.1":{"tag":"1.1.1","author":"jerrystewart99","date":"2025-12-20 21:03:39"}},"upgrade_notice":{"1.1":"<p>Added ability to set <em>The Fold<\/em> per page, per device<\/p>"},"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.1.0","1.1.1"],"block_files":[],"assets_screenshots":{"Screenshot-1.png":{"filename":"Screenshot-1.png","revision":3220566,"resolution":"1","location":"assets","locale":""},"Screenshot-2.png":{"filename":"Screenshot-2.png","revision":3220566,"resolution":"2","location":"assets","locale":""}},"screenshots":{"1":"Above <em>The Fold<\/em> image loading without plugin - Atf image being lazy loaded =&gt; <strong>BAD<\/strong>","2":"Above <em>The Fold<\/em> image loading with plugin enabled - aft image <strong>not<\/strong> lazy loaded"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1516,10731,133,20766,4884],"plugin_category":[],"plugin_contributors":[184797],"plugin_business_model":[],"class_list":["post-197385","plugin","type-plugin","status-publish","hentry","plugin_tags-above-the-fold","plugin_tags-divi","plugin_tags-image","plugin_tags-lazy","plugin_tags-lazy-load","plugin_contributors-jerrystewart99","plugin_committers-jerrystewart99"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/lazy-load-fix-for-divi.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/lazy-load-fix-for-divi\/assets\/Screenshot-1.png?rev=3220566","caption":"Above <em>The Fold<\/em> image loading without plugin - Atf image being lazy loaded =&gt; <strong>BAD<\/strong>"},{"src":"https:\/\/ps.w.org\/lazy-load-fix-for-divi\/assets\/Screenshot-2.png?rev=3220566","caption":"Above <em>The Fold<\/em> image loading with plugin enabled - aft image <strong>not<\/strong> lazy loaded"}],"raw_content":"<!--section=description-->\n<p>Offers Fine-grained control for manually setting the threshold which images on a Divi page are lazy-loaded.<\/p>\n\n<p>Includes a fix for a Divi bug that causes incorrect calculation of the lazy-load threshold.<\/p>\n\n<h4>Background<\/h4>\n\n<p>To improve page load performance, modern browsers allow for images and other media to be lazy loaded. Lazy loading defers media loading until after the first page render.<\/p>\n\n<p>For best page load performance, only <em>Below The Fold (btf)<\/em> media should be lazy loaded. <em>Below The Fold<\/em> means the part of the page that is not visible on first page load, prior to any scrolling.<\/p>\n\n<p>Google Page Speed Insights (PSI) will rightly complain if media <em>atf<\/em> are lazy loaded, and also if media <em>btf<\/em> are not lazy loaded.<\/p>\n\n<p>In version 5.7.0, Wordpress added a feature that automatically adds the loading=\"lazy\" attribute to media it considers to be <em>btf<\/em>. What it considers <em>btf<\/em> basically means everything after the 3rd media component irrespective of page design.<\/p>\n\n<p>Divi's Critical CSS feature attempts to do a better job of determining the fold by analysing the raw page modules' shortcodes. \nDivi offers different threshold settings of where it considers <em>The Fold<\/em> to be. eg. 'Low', 'Medium' or 'High'. (This setting is found in Divi Settings|Performance|Critical CSS Threshold.)<\/p>\n\n<p>The exact position of <em>The Fold<\/em> however, depends on a few factors, perhaps the most obvious is the screen width. Divi's analysis is approximate and is easily confused by the use of additional custom css.<\/p>\n\n<h4>How the Lazy-Load-Fix-for-Divi plugin works<\/h4>\n\n<p>This plugin allows the developer to determine the exact position of <em>The Fold<\/em> by manually setting it's location for each page. You can do this after making a simple observation in a browser at the screen widths you want to optimise for.<\/p>\n\n<p>For example, suppose you decide that you want to optimise for the following screen resolutions:<\/p>\n\n<pre><code>1200 x 834 - desktop\n320 x 820 - mobile\n<\/code><\/pre>\n\n<p>(these are the approximate resolutions that Google PSI uses)<\/p>\n\n<p>Then, after completing your page design, inspect your page in a browser that is set to these dimensions<code>(note 1)<\/code> and identify the first Divi module that is <em>btf<\/em>.<\/p>\n\n<p>To manually set the threshold, add one or more of the custom classes to the first Divi module <em>btf<\/em>.<code>(note 2)<\/code>.<\/p>\n\n<p>Allowed values are:<\/p>\n\n<pre><code>ww-btf-desktop\nww-btf-mobile\nww-btf-tablet (see note 3)\n<\/code><\/pre>\n\n<p>All media items <em>btf<\/em> will be lazy-loaded, those <em>atf<\/em> won't be.<\/p>\n\n<p>Repeat in the same way to set up thresholds for each page you want to optimise for.<\/p>\n\n<ul>\n<li>Note that <code>ww-btf-tablet<\/code> is not implemented in this version and will be treated as <code>ww-btf-mobile<\/code><\/li>\n<\/ul>\n\n<h4>Notes<\/h4>\n\n<p><strong>Note 1 -- Set a browser to a specific resolution<\/strong> I suggest using Chrome with Developer Tools enabled (right click, select <em>Inspect<\/em>). Resizing the window with a mouse shows the window size next to the cursor.\n<strong>Note 2 -- Add a custom class to a Divi module<\/strong> Edit the module and select the <em>Advanced<\/em> tab and use <em>CSS ID &amp; Classes<\/em>\n<strong>Note 3 --<\/strong> Tablet devices are not implemented in this plugin version and will be treated as if they were <code>ww-btf-mobile<\/code><\/p>\n\n<h3>Divi BUG<\/h3>\n\n<p>In addition, this plugin fixes a code bug in Divi relating to the lazy loading of images. (introduced in 4.5.2 and still present in 4.27.4)<\/p>\n\n<p>The problem occurs in<\/p>\n\n<pre><code>Divi\\includes\\builder\\core.php @ line #63\n<\/code><\/pre>\n\n<p>- the remove_filter() call quietly fails because the priority is not specified. This bug results in the Wordpress media counting logic to be run twice which defeats the lazy-load threshold when using Divi. \nThe Wordpress function remove_filter() specifies parameter 3 as <code>int $priority = 10<\/code>. If the priority is not 10 (in this case it is actually 12), the remove_filter call fails.<\/p>\n\n<p>I guess Elegant Themes's priority are now with version 5 so this bug may not ever get fixed. If the bug ever gets fixed, this bugfix part of this plugin will have no effect.<\/p>\n\n<p>This bugfix is distinct from and will work independently from the custom setting of the custom classes described above.<\/p>\n\n<p><strong>Note:<\/strong> I contacted Elegant Themes about the bug and was advised to use the plugin: <a href=\"https:\/\/wordpress.org\/plugins\/disable-lazy-loading\/\">\"Disable Lazy Loading\"<\/a> \nwhich does an excellent job of disabling <strong>ALL<\/strong> lazy loading. \nIn this case though, this is not the behaviour I want.<\/p>\n\n<p>My motivation for writing this plugin is to improve the Google PSI score on Mobile and Desktop devices.<\/p>\n\n<p>I welcome helpful comments and suggestions :)<\/p>\n\n<p>This plugin will have no effect if used on Divi &lt; 4.5 or on Wordpress &lt; 5.7.0<\/p>\n\n<!--section=installation-->\n<p>Lazy Load Fix For Divi just as you would any other WP Plugin:<\/p>\n\n<ol>\n<li><p><a href=\"https:\/\/wordpress.org\/plugins\/lazy-load-fix-for-divi\" title=\"Lazy Load Fix for Divi\">Download Lazy Load For Divi<\/a> from WordPress.org.<\/p><\/li>\n<li><p>Unzip the .zip file.<\/p><\/li>\n<li><p>Upload the Plugin folder (lazy-load-fix-for-divi\/) to the wp-content\/plugins folder.<\/p><\/li>\n<li><p>Go to <a href=\"https:\/\/codex.wordpress.org\/Administration_Panels#Plugins\" title=\"Plugins Admin Panel\">Plugins Admin Panel<\/a> and find the newly uploaded Plugin, \"Lazy Load Fix for Divi\" in the list.<\/p><\/li>\n<li><p>Click Activate Plugin to activate it.<\/p><\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id='will%20this%20plugin%20work%20on%20my%20wordpress.com%20website%3F'><h3>Will this Plugin work on my WordPress.com website?<\/h3><\/dt>\n<dd><p>Sorry, this plugin is available for use only on self-hosted (WordPress.org) websites.<\/p><\/dd>\n<dt id='can%20i%20use%20this%20plugin%20with%20the%20divi%20builder'><h3>Can I use this plugin with the Divi Builder<\/h3><\/dt>\n<dd><p>This plugin has only been tested with the Divi Theme to date. It may work with Divi Builder using a different theme. Please do let me know how that goes :)<\/p><\/dd>\n<dt id='what%20divi%20settings%20should%20i%20use'><h3>What Divi settings should I use<\/h3><\/dt>\n<dd><p>This is a performance tweak plugin. It is only effective if Divi's performance options are ENABLED, and in particular Critical CSS <strong>must<\/strong> be ENABLED for this plugin to have any effect. (This is the Divi default)<\/p><\/dd>\n<dt id='will%20this%20work%20on%20divi%205%3F'><h3>Will this work on Divi 5?<\/h3><\/dt>\n<dd><p>No. Divi 4 only please.<\/p><\/dd>\n<dt id='how%20do%20i%20use%20this%20plugin%3F'><h3>How do I use this plugin?<\/h3><\/dt>\n<dd><p>Install and activate. Add custom classes as per description. That's it!<\/p><\/dd>\n<dt id='how%20to%20uninstall%20the%20plugin%3F'><h3>How to uninstall the plugin?<\/h3><\/dt>\n<dd><p>Simply deactivate and delete the plugin. It will clean up nicely and leave no trace.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.1.1<\/h4>\n\n<p>Tested up to 6.9<\/p>\n\n<h4>1.1<\/h4>\n\n<p>Added ability to set <em>The Fold<\/em> per page, per device<\/p>\n\n<h4>1.0<\/h4>\n\n<p>Inital Release - Divi bugfix only<\/p>","raw_excerpt":"Provides precise control of which media (images) are lazy-loaded for optimum page load performance.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/197385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=197385"}],"author":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/jerrystewart99"}],"wp:attachment":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=197385"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=197385"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=197385"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=197385"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=197385"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=197385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}