Created
August 20, 2022 16:32
-
-
Save sabrina-zeidan/1768ba63de7129a85dcb6420d89eb0f1 to your computer and use it in GitHub Desktop.
Fix WP Rocket Lazyload not working properly on Safari/Chrome 15.4 if loading=lazy is present on the image [WordPress]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Known issue in Safari 15.4, happens in WPR as well as in other LL plugins | |
//https://github.com/wp-media/wp-rocket/issues/4961 | |
//Removes loading="lazy" by filtering output buffer in case it wasn't removed in the regular way | |
add_filter('rocket_buffer', 'sz_wprocket_filter_buffer_native_ll', 10); | |
function sz_wprocket_filter_buffer_native_ll ($buffer){ | |
$buffer = str_replace('loading="lazy"', '', $buffer); | |
return $buffer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment