I have a weird issue going on in WordPress at the moment. Some images does not return any image sizes, and when using wp_get_attachment_image_srcset it simply returns false. I have no idea why this is happening.

What I have tried, however, to no avail:

  1. Disabling my theme and all plugins
  2. Regenerating thumbnails for the specific attachment
  3. Verifying that the physical images are actually on disk - they are, and I can query them fine directly in the URL-address-bar.
  4. Trying to regenerate missing thumbnails as recommended here: Regenerate missing _wp_attachment_metadata (despite the thumbnails are not really missing, as they are on disk)

So to be precise:

  1. wp_get_attachment_image_srcset returns false for some attachments, but not all
  2. wp_get_attachment_metadata returns metadata, however, the sizes array is empty

output of a working and a non working result


It seems as though a lot of people have had problems with this, however, no real solution, and many have made workarounds:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.