Hello fellow developers,
I am currently working on a side project using WP as my headless CMS which I consume via the REST API. When I retrieve the post’s rendered content (post.content.rendered) my images are rendered like this:
<figure class=”wp-block-image size-large”>
<img decoding=”async” src=”image.jpg” />
</figure>
How can I customize this output HTML, so that I can edit the `img` tag attributes? What I would like to do on my frontend is add lazyloading and reduce layout shift, which is typically achieved via HTML attributes and CSS. Ideally my output would look something like this:
<figure class=”wp-block-image”>
<img loading=”lazy” data-src=”image.jpg” />
</figure>
Thanks!
Ricky
[ad_2]