Been googling like crazy but come up empty. Is it possible to modify the src attribute with the core image block? I want to replace src
with data-src
for lazy loading images without the native functionality.
-
Native lazy losing is now supported in all major browsers, so there’s no reason to do this.– Jacob PeattieCommented Mar 1, 2022 at 9:11
-
@JacobPeattie I kind of agree, however, the native lazy is not as flexible/tweakable as a custom lazy function can be.– INTCommented Mar 1, 2022 at 14:03
Add a comment
|
1 Answer
You want to take a look at the Codex about Block Filters.
You'll need to make a filter using add_filter
and hook into render_callback
by re-registering core/image
and modifying the render callback.