0) is still rendered through * wp_get_attachment_image() (srcset, current size files); this class supplies the fallback used when that * returns nothing (attachment deleted, external URL): the stored size URL first, then the original URL. */ final class Media { /** * Fallback image URL for `$size`: `sizes[$size].url`, else `url`, else ''. * * @param array $image */ public static function fallback_url(array $image, string $size): string { $sizes = isset($image['sizes']) && is_array($image['sizes']) ? $image['sizes'] : []; $entry = isset($sizes[$size]) && is_array($sizes[$size]) ? $sizes[$size] : []; if (isset($entry['url']) && is_string($entry['url']) && $entry['url'] !== '') { return $entry['url']; } return isset($image['url']) && is_string($image['url']) ? $image['url'] : ''; } }