Solution is simple, check that is_admin()
returns false before doing any modifications to the content, or hook on admin_init
to add you hooks.
I don’t think that the_content
is used in the context of admin, but thumbnail generation might be used.
Another thing to keep in your mind is that those hooks might be triggered when AJAX/REST responses are generate (depending on their content), at which case it is not obvious whether you should still use lazy loading at all.