• George

    (@georgevoronca)


    Hello guys,

    I decided to write here after searching a lot a solution on the internet (including this forum and documentation section). After testing my self hosted WordPress site speed with two browsers (Chrome and Firefox), I noticed that some posts contain several image tags without srcset and sizes attributes. As browsers display, only the full or scaled sizes are downloaded which affects badly my site performance (especially on mobile version).

    I don’t know why some images are served properly and other not. I checked the upload folder location and all images are generated accordingly with multiple sizes (e.g thumbnail, medium, medium-large, large).

    Other details:
    – WP version is 5.5;
    – I use my custom theme where I set “wp_calculate_image_sizes” hook within functions.php file based on screen width.
    – running plug-ins – JetPack, Yoast

    Hope it helps.
    Thanks for trying to support me!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Please provide a link to a page on your site where we can see this. Thanks. Note: Your link will be public and we will not later remove it.

    How were those images added to the post/page?

    Thread Starter George

    (@georgevoronca)

    Hi Steven,

    This is the link to one of the posts.

    The images were uploaded through media gallery and then inserted within the post editor.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I see. Are you using the block editor or the classic editor?

    Thread Starter George

    (@georgevoronca)

    I use the classic editor. I compared the HTML markup of the “good” and “bad” posts and I did not see any difference. “Good” means posts with images tag having srcset and sizes attributes.

    Edit 1: When I say HTML markup, I refer to the code within the block editor.

    Edit 2: Just to avoid confusion. The HTML markup from the block editor is the same for image tags, no matter the post. On the other hand, from browsers some image tags do not have srcset and sizes at all.

    • This reply was modified 5 years, 12 months ago by George.
    • This reply was modified 5 years, 12 months ago by George.
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Let’s test that it’s your theme. Switch to twentytwenty and make a new post to match the example. Do you get srcsets?

    Thread Starter George

    (@georgevoronca)

    No, unfortunately I got the same behavior.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘missing srcset and sizes attributes’ is closed to new replies.