You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The gist of the issue is that the_post_thumbnail() passes the named size post-thumbnail to get_the_post_thumbnail() which, in turn, uses wp_get_attachment_image() to build the markup. In core, we are converting the returned size to a size array before calling wp_calculate_image_srcset() but in the plugin we are filtering the wp_get_attachment_image_attributes and are passing the size name to wp_get_attachment_image_srcset().
Perhaps we should transform the named size into an array an use wp_calculate_image_srcset() in tevkori_filter_attachment_image_attributes() to be consistent, but I also wonder if we should allow unnamed sizes passed to wp_get_attachment_image_srcset() to fall back to the full size image to be consistent with the behavior of wp_get_attachment_image().
The text was updated successfully, but these errors were encountered:
Actually, wp_get_attachment_srcset() does fall back to the full size image, but wp_get_attachment_sizes() returns false, which is why the attributes are not being added.
This issue only happened if no post thumbnail size was specified with set_post_thumbnail_size().
The problem has been fixed already in branch dev by commit 27d1b53 where the sizes function has been split into two functions.
See this support thread at WP.org.
The gist of the issue is that
the_post_thumbnail()
passes the named sizepost-thumbnail
toget_the_post_thumbnail()
which, in turn, useswp_get_attachment_image()
to build the markup. In core, we are converting the returned size to a size array before callingwp_calculate_image_srcset()
but in the plugin we are filtering thewp_get_attachment_image_attributes
and are passing the size name towp_get_attachment_image_srcset()
.Perhaps we should transform the named size into an array an use
wp_calculate_image_srcset()
intevkori_filter_attachment_image_attributes()
to be consistent, but I also wonder if we should allow unnamed sizes passed towp_get_attachment_image_srcset()
to fall back to the full size image to be consistent with the behavior ofwp_get_attachment_image()
.The text was updated successfully, but these errors were encountered: