Add retina “2x” in attribute “srcset”

WordPress puts all resized versions of an image with the same aspect ratio into the srcset property. So if you need a “2x” image and one is not being generated already you could add an image size via add_image_size().

For the 2x image to be inserted in the correct circumstances you might need to tweak the sizes property via the wp_calculate_image_sizes filter.