templates – Display “large” image size in attachment page


On the attachment page for an image, I’d like to display the image in its “large” size. The current behavior is showing the “medium” size image.

I’m using a theme I created from underscores.

The relevant part of the template file that outputs the image on the attachment page is (in template-parts/content.php):

                /* translators: %s: Name of current post. Only visible to screen readers */
                __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'vanguard-history' ),
                    'span' => array(
                        'class' => array(),
            wp_kses_post( get_the_title() )

… which is basically just sanitization of the_content().

What I see in the HTML in one example attachment page is:

<p class="attachment">
<a href="http://localhost:8888/vanguard-history/content/uploads/2021/11/Myron_Rosander_Addressing_2001_Santa_Clara_Vanguard_on_Final_Day_of_Tour.jpg">
    <img src="http://localhost:8888/vanguard-history/content/uploads/2021/11/Myron_Rosander_Addressing_2001_Santa_Clara_Vanguard_on_Final_Day_of_Tour-300x225.jpg" class="attachment-medium size-medium" alt="" loading="lazy"   width="300" height="225">

note the classes of “attachment-medium” and “size-medium” and the dimensions of my “medium” media size.

Where can I change the size displayed on attachment pages from “medium” to “large”? I can’t find a setting anywhere for this.

Also, in some older WordPress sites I’ve made, the default display was large, and they were also using the_content() to display the image. I”m not sure what’s different here.

WordPress 5.8.2

Mike Eng 2 weeks 2021-11-20T21:22:39-05:00 0 Answers 0 views 0

Leave an answer