Output Original Image Size in WordPress

Here’s how you can output the original image size using the wp_get_attachment_image() function:

<?php echo wp_get_attachment_image( $image_id, 'original_image', false ); ?>

The key is to use original_image as the size attribute. This will output the original image with no scaling applied. This should be used sparingly because original images are usually a large file size.

Alternatively using full as the size attribute will output the full image size but only if the image width/height is less than the big_image_size_threshold (by default it’s 2560px).

Leave a Reply

Your email address will not be published. Required fields are marked *