Created
August 22, 2019 16:51
-
-
Save CFranc111/ca7b7ab6108ce293365f380d5e99b6b2 to your computer and use it in GitHub Desktop.
Wordpress add lazy loading all content
This file contains hidden or 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
function enzothecat_add_lazy_loading($content) { | |
$content = preg_replace('/src="/', 'loading="lazy" src="', $content); | |
return $content; | |
} | |
add_filter('the_content', 'enzothecat_add_lazy_loading'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment