I want to get all sizes of an attachment. I can use wp_get_attachment_metadata to do this. But it only return filenames, not file urls.
How can I do this?
This is a workaround, but doesn’t take stuff such as CDNs into account:
$attachment_id = get_term_meta( $term->term_id, 'thumbnail_id', true);
$image = wp_get_attachment_metadata($attachment_id);
$image['id'] = $attachment_id;
foreach($image['sizes'] as $key => $image_size) {
$image['sizes'][$key]['url'] = wp_upload_dir()['baseurl'] . "https://wordpress.stackexchange.com/" . dirname($image['file']) . "https://wordpress.stackexchange.com/" . $image_size['file'];
}