Home › Forums › WoodMart support forum › Wrong image ”sizes” attribute
Wrong image ”sizes” attribute
- This topic has 0 replies, 1 voice, and was last updated 19 hours, 38 minutes ago by
esentoglobal.
-
AuthorPosts
-
September 7, 2025 at 11:25 am #684885
esentoglobalParticipantHello Woodmart Support Team,
I hope you are well.
I am facing a persistent performance issue related to how product images are handled on archive pages (shop, product categories) on my website, esento.ro.
The Problem:
The theme is generating an incorrect sizes attribute for product images in the grid. This causes the browser to request and download unnecessarily large images from our image optimization CDN (Optimole), which negatively impacts the Largest Contentful Paint (LCP) and the overall PageSpeed score.For example, for a container that is only 186px wide on desktop, the generated sizes attribute instructs the browser to download an image that is 860px wide, as you can see in this PageSpeed Insights report:
https://pagespeed.web.dev/analysis/https-esento-ro-parfumuri-parfumuri-femei/doiahz6oie?form_factor=mobileTroubleshooting Steps Taken:
This is not a plugin issue. We have confirmed this by:Experiencing the exact same problem with a different image optimization plugin, ShortPixel, where the image had no srcset tag and served the actual size of the image even on gallery thumbs. We switched to Optimole thinking that their plugin and CDN serves the responsive image that best fit the actual screen, but the issue persisted even after switching to Optimole.
Ensuring all server-side and client-side performance metrics (TTFB, TBT, CLS) are excellent after extensive optimization. The oversized images are the last remaining problem.
Attempting to fix the issue by using a PHP filter for wp_calculate_image_sizes to provide the correct values. Here is the code we used:
PHP function esento_universal_image_sizes( $sizes, $size ) { if ( is_front_page() ) { $sizes = '(max-width: 768px) 66vw, 40vw'; } elseif ( is_product_category() || is_product_tag() || is_shop() ) { $sizes = '(max-width: 768px) 50vw, 25vw'; } return $sizes; } add_filter( 'wp_calculate_image_sizes', 'esento_universal_image_sizes', 20, 2 );
Even with this filter active, the theme appears to be overwriting these correct sizes with its own generic values at a later stage.
Our Hypothesis:
We believe the Woodmart theme is using a high-priority filter or another method to override the standard WordPress sizes attribute calculation, causing this issue.Our Request:
Could you please investigate this and provide a reliable method (e.g., a code snippet with the correct hook and priority, or a theme setting) to ensure the correct, responsive sizes attributes are applied to product images on archive pages?Also, please bear in mind that we cannot use the actual step you require, which is deactivating all plugins except those required by the theme, as the website is live, but we did all we could to mitigate it.
Thank you for your time and assistance.
Best regards,
Gabriel -
AuthorPosts
Tagged: image sizes, srcset
- You must be logged in to create new topics. Login / Register