replace wp_get_attachment_image with my own function
There is a filter, wp_get_attachment_image_attributes, for the image attributes– a well designed one too. function alter_att_attributes_wpse_102079($attr) { $attr[‘data-src’] = $attr[‘src’]; return $attr; } add_filter( ‘wp_get_attachment_image_attributes’, ‘alter_att_attributes_wpse_102079’); That will add the data-src attribute. That looks like what you need. You could add more attributes, or alter the existing onese, if you need.