I'm looking to pull all of the metadata (e.g. alt, width, height) from the theme logo, which is uploaded through Appearance -> Customization into my theme template file. This is what I currently have, but it's not working:
$custom_logo_id = get_theme_mod('custom_logo');
if ($custom_logo_id) {
$image = wp_get_attachment_image_src($custom_logo_id, 'full');
$meta = wp_get_attachment_metadata($custom_logo_id);
echo '<img src="' . $image[0] . '" alt="' . $meta['alt'] . ' width="' . $meta['width'] . '" height="' . $meta['height'] . '">';
} else {
echo bloginfo('name');
}