Closed joemcgill closed 8 years ago
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 27d1b5367fc4a8d5ba05652e0c4e28567f21c6da 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()
.