David Stockdale's Scrapcode

Embedded Posts Loading Fix

After updating the various wordpress sites I maintain to WordPress 5.7 I began to notice embedded posts not loading.

After a few tests I realized that sometimes the embedded posts would load (which I found by opening 4-5 new tabs of the same post) just not consistantly.

This lead me to assume that this was some sort of problem with the new “Lazy Loading” feature added in a recent update.

Thus I applied a quick fix which disabled Lazy Loading by default.

/**
 * Disables lazy loading (Done to fix embedded posts not loading consistantly).
 */ 
add_filter( 'wp_lazy_loading_enabled', '__return_false' );

After adding this code to function.php I had no more problems (although the sites load noticably slower).

Leave a Reply