How to add data attribute to all images in posts [closed]

You have a number of options.

You could use the add_filter( 'the_content', 'add_data_attributes' );
And after that find the images attached to the post.

Or you can use the image_send_to_editor filter more here.