Forked from CFranc111/gist:ca7b7ab6108ce293365f380d5e99b6b2
Created
August 28, 2019 12:21
-
-
Save mihdan/b31cd90bbd096e25d3d0aa449d5b78c8 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