From 4a8f3c6eef7257becbb7b7483fadc40a59910c64 Mon Sep 17 00:00:00 2001 From: Juan Padial Date: Tue, 30 Jan 2018 18:39:10 +0100 Subject: [PATCH] Add custom elements on content output By using `the_content` filter instead of `content_save_pre`, the custom element `` is added on the fly before the content output. This approach avoid to get stuck to PWP Lazy Image plugin in the future: you will be able to switch between themes, lazy load plugins, or even between publishing platforms without the need to rewrite every post. --- src/pwp-lazy-image-plugin/pwp-lazy-image-plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pwp-lazy-image-plugin/pwp-lazy-image-plugin.php b/src/pwp-lazy-image-plugin/pwp-lazy-image-plugin.php index 63c4dc9..81f0a1d 100644 --- a/src/pwp-lazy-image-plugin/pwp-lazy-image-plugin.php +++ b/src/pwp-lazy-image-plugin/pwp-lazy-image-plugin.php @@ -74,5 +74,5 @@ function lazify_images($content) { return ''; }, $content); } - add_filter('content_save_pre' , 'lazify_images', 0, 1); + add_filter('the_content' , 'lazify_images', 0, 1); ?>