$value['src']['id'], 'src' => $src, 'width' => (int) $width, 'height' => (int) $height, 'srcset' => wp_get_attachment_image_srcset( $value['src']['id'], $value['size'] ), 'alt' => get_post_meta( $value['src']['id'], '_wp_attachment_image_alt', true ), ]; } if ( empty( $value['src']['url'] ) ) { throw new \Exception( 'Invalid image URL.' ); } return [ 'src' => $value['src']['url'], ]; } }