Created
August 19, 2019 13:53
-
-
Save huytrq/a6c4d362518bc6d46e80f4a5375239b6 to your computer and use it in GitHub Desktop.
Add lazyload to image and iframe
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
| <?php | |
| function ht_add_lazy_loading($content) { | |
| $content = preg_replace('/src="/', loading="lazy" src="', $content); | |
| return $content; | |
| } | |
| add_filter('the_content', ht_add_lazy_loading); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment