GoogleChromeLabs / GoogleChromeLabs/ProgressiveWordPress

PWP Lazy Image plugin: Filter content on output, not on input

Open
#17 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
561
Forks
93
PR merge metrics
No merged PRs in 30d

Description

Hey!! I think that custom elements should replace native images elements on content output, not on content input. Actually, the content is modified and saved to database. In this way you get stuck to PWP lazy image plugin. If you want to use other lazy load solution or want to change the theme at any point in the future, you will need to rewrite all the posts content and save them again to database.

Alternative: use `the_conent` filter instead of `content_save_pre`. This way you preserve the content in the native format and you are free to switch between themes, lazy load solutions or even publishing platforms at any time:

`add_filter('the_content' , 'lazify_images', 0, 1);`

It can add a very little extra work in every request, but you get more freedom. What do you think?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.